@mintlify/cli 4.1.96 → 4.1.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -552,7 +552,7 @@ Next steps:`,`1. Clone the knowledge base into ./${i}:`,` git -c http.${r.remo
552
552
  Next steps:`,`1. Clone the hosted repository into a separate directory. Do not replace the user’s existing Git remote.`,`2. Copy the selected documentation into its root, including docs.json, .md/.mdx pages, images, and other required assets. Exclude credentials, .env files, node_modules, and .git.`,`3. Commit the documentation. For subsequent updates, fetch the hosted main branch and commit on top of it. Do not force-push.`,`4. Push to main. Supply the write token as an HTTP Authorization: Bearer header for this Git operation only; never embed it in the remote URL or persist it in Git config.`,`5. If the write token expires, run mint deploy again from the same documentation directory to obtain a fresh token.`,`A successful push starts the normal build. Provisioning and Git success do not confirm build success.`,``,`Git examples (POSIX shell): set REPOSITORY_URL and WRITE_TOKEN from the output above. Set CHECKOUT_DIR to a new directory outside the source documentation directory. Keep the token private and do not enable shell tracing.`,'GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${REPOSITORY_URL}.extraHeader" GIT_CONFIG_VALUE_0="Authorization: Bearer ${WRITE_TOKEN}" git clone "$REPOSITORY_URL" "$CHECKOUT_DIR"',`After copying and committing the documentation:`,'GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="http.${REPOSITORY_URL}.extraHeader" GIT_CONFIG_VALUE_0="Authorization: Bearer ${WRITE_TOKEN}" git -C "$CHECKOUT_DIR" push origin HEAD:main',`These settings apply only to that Git process. Use the same authentication settings for later fetches.`,``,...t?[`Claim link for the user: ${t}`,`Show this link to the user. They open it, sign in, and click Confirm; the site moves into their account. Do not sign in on their behalf. There is no code to relay.`]:Km].join(`
553
553
  `):``}var Xm=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const Zm=bn({id:yn().int().positive(),full_name:Sn().regex(/^[\w.-]+\/[\w.-]+$/),default_branch:Sn().min(1)}),Qm=Rn.join(`.github`,`workflows`,`mintlify.yml`);function $m(e,t,n){return new Promise((r,i)=>{Fn(e,t,{cwd:n},(e,t)=>e?i(e):r(String(t).trim()))})}function eh(e){let t=e.trim().match(/^(?:https:\/\/(?:[^@/]+@)?github\.com\/|ssh:\/\/git@github\.com(?::\d+)?\/|git@github\.com:)([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/);return t?.[1]&&t[2]?{owner:t[1],repo:t[2]}:null}function th(e,t,n=``){let r=/^[\w./-]+$/.test(n)?n:JSON.stringify(n);return[`name: Deploy to Mintlify`,`on:`,` push:`,` branches: [${JSON.stringify(e)}]`,...n?[` paths: [${JSON.stringify(`${n}/**`)}, ".github/workflows/mintlify.yml"]`]:[],`permissions:`,` id-token: write`,` contents: read`,`concurrency:`,` group: mintlify-deploy`,` cancel-in-progress: true`,`jobs:`,` deploy:`,` runs-on: ubuntu-latest`,` steps:`,` - uses: actions/checkout@v4`,` - run: npx mint@latest deploy --subdomain ${t}${n?` --directory ${r}`:``}`,``].join(`
554
554
  `)}function nh(e){return Xm(this,void 0,void 0,function*(){return Wn.readFile(e,`utf8`).catch(e=>{if(e.code!==`ENOENT`)throw e})})}function rh(e,t){return Xm(this,arguments,void 0,function*(e,t,n=!1){let r=Rn.join(e,Qm),i=yield nh(r);if(i===t)return`unchanged`;if(i!==void 0&&!n)throw Error(`${Qm} already exists with different contents. Pass --force to overwrite it.`);return yield Wn.mkdir(Rn.dirname(r),{recursive:!0}),yield Wn.writeFile(r,t),i===void 0?`created`:`updated`})}function ih(e){return Xm(this,void 0,void 0,function*(){try{return yield $m(`git`,[`rev-parse`,`--show-toplevel`],e)}catch{throw Error(`--github requires a Git repository. Run it inside your docs repository.`)}})}function ah(e){return Xm(this,void 0,void 0,function*(){let t=yield $m(`git`,[`remote`,`get-url`,`origin`],e).catch(()=>{throw Error(`This repository has no origin remote. Add a github.com origin and retry.`)}),n=eh(t);if(!n)throw Error(`The origin remote (${t}) is not a github.com repository.`);let r=yield $m(`gh`,[`api`,`repos/${n.owner}/${n.repo}`,`--jq`,`{id: .id, full_name: .full_name, default_branch: .default_branch}`],e).catch(e=>{throw e.code===`ENOENT`?Error("The GitHub CLI (gh) is required. Install it and run `gh auth login`."):Error(`Could not read ${n.owner}/${n.repo} with gh. Run \`gh auth login\` with access to the repository and retry.`)});try{return Zm.parse(JSON.parse(r))}catch{throw Error(`gh returned an unexpected repository response.`)}})}function oh(e,t){return Xm(this,arguments,void 0,function*(e,t,n=()=>{}){let r=Rn.resolve(e.directory),i=yield ih(r),[a,o]=yield Promise.all([Wn.realpath(i),Wn.realpath(r)]),s=Rn.relative(a,o).split(Rn.sep).join(`/`);if(!(yield nh(Rn.join(r,`docs.json`))))throw Error(`No docs.json in ${r}. Pass the docs folder with --directory.`);n(`Resolving the GitHub repository...`);let c=yield ah(i),l=yield Mm(e,t,n);if(l.status===`claimed`)throw Error(`This site has been claimed. Setting up GitHub deploys for claimed sites is not supported yet; connect the repository from the Mintlify dashboard.`);let u=l.credentials.accessToken;if(!u)throw Error(`Agent authentication did not return an access token.`);n(`Trusting ${c.full_name}@${c.default_branch} to deploy...`),yield Am(e.apiUrl,u,{repositoryId:String(c.id),repository:c.full_name,branch:c.default_branch});let d=yield rh(i,th(c.default_branch,l.site.subdomain,s),e.force);return{siteUrl:Nm(e.apiUrl,l.site.subdomain),subdomain:l.site.subdomain,repository:c.full_name,branch:c.default_branch,workflowPath:Qm,workflow:d}})}function sh(e){return[`Site: ${e.siteUrl}`,`Trusted repository: ${e.repository} (branch ${e.branch})`,`Workflow: ${e.workflowPath} (${e.workflow})`,``,`Next steps:`,`1. Commit and push ${e.workflowPath} to ${e.branch}.`,`2. Every push to ${e.branch} then deploys ${e.subdomain} through GitHub Actions. No secrets are stored in the repository.`,``,...Km].join(`
555
- `)}var ch=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const lh=[`bug`,`docs`,`idea`];function uh(e){return ch(this,void 0,void 0,function*(){let t;try{t=yield fetch(`${rt}/api/cli/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(Object.assign(Object.assign({},e),{source:`cli`}))})}catch{return`could not reach the server`}return t.ok?void 0:`could not send feedback (HTTP ${t.status})`})}function dh(e){return ch(this,void 0,void 0,function*(){let t=yield uh(e);return D(t?(0,P.jsx)(c,{message:t}):(0,P.jsx)(o,{message:`feedback sent`})),!t})}var fh=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},ph=function(e){return this instanceof ph?(this.v=e,this):new ph(e)},mh=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},hh=function(e){var t={},n;return r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:ph(e[r](t)),done:!1}:i?i(t):t}:i}},gh=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof ph?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function _h(){return fh(this,void 0,void 0,function*(){try{let e=yield Wn.readFile(Rn.join(et,`.gitignore`),`utf-8`);return le(e)}catch{return[]}})}function vh(e,t){return gh(this,arguments,function*(){let n=yield ph(Wn.readdir(e,{withFileTypes:!0}));for(let r of n){let n=Rn.join(e,r.name),i=Rn.relative(et,n).split(Rn.sep).join(`/`);De(i,t,r.isDirectory())||(r.isDirectory()?yield ph(yield*hh(mh(vh(n,t)))):r.name.endsWith(`.mdx`)&&(yield yield ph(n)))}})}const yh=()=>fh(void 0,void 0,void 0,function*(){var e,t,n,r;let{mdxToPm:i,pmToMdx:a,canonicalPmToMdxOptions:s}=yield import(`./converter-CslM9_W8.js`),l=[...yield _h(),...yield ge(et)],u=ce(l),d=0,f=0,p=0;try{for(var m=!0,h=mh(vh(et,u)),g;g=yield h.next(),e=g.done,!e;m=!0){r=g.value,m=!1;let e=r;d++;let t=Rn.relative(et,e);try{let t=yield Wn.readFile(e,`utf-8`),n=t,r=0;for(let e=0;e<3;e++){let{doc:t,frontmatter:o}=i(n);e===0&&(r=Object.keys(o).length);let c=`${a(t,Object.assign({frontmatter:o},s))}\n`;if(c===n)break;n=c}if(r>0&&!n.startsWith(`---`))throw Error(`formatting would remove frontmatter; file left untouched`);n!==t&&(yield Wn.writeFile(e,n),f++)}catch(e){p++,D((0,P.jsx)(c,{message:`${t}: ${e instanceof Error?e.message:`unknown error`}`}))}}}catch(e){t={error:e}}finally{try{!m&&!e&&(n=h.return)&&(yield n.call(h))}finally{if(t)throw t.error}}D((0,P.jsx)(o,{message:`formatted ${f} of ${d} mdx file${d===1?``:`s`}${p>0?` (${p} failed)`:``}`})),yield N(+(p>0))});var bh=/* @__PURE__ */ n(((e,t)=>{t.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}})),xh=/* @__PURE__ */ n((e=>{let t={INVALID_LOC:`Invalid LOC header (bad signature)`,INVALID_CEN:`Invalid CEN header (bad signature)`,INVALID_END:`Invalid END header (bad signature)`,DESCRIPTOR_NOT_EXIST:`No descriptor present`,DESCRIPTOR_UNKNOWN:`Unknown descriptor format`,DESCRIPTOR_FAULTY:`Descriptor data is malformed`,NO_DATA:`Nothing to decompress`,BAD_CRC:`CRC32 checksum failed {0}`,FILE_IN_THE_WAY:`There is a file in the way: {0}`,UNKNOWN_METHOD:`Invalid/unsupported compression method`,AVAIL_DATA:`inflate::Available inflate data did not terminate`,INVALID_DISTANCE:`inflate::Invalid literal/length or distance code in fixed or dynamic block`,TO_MANY_CODES:`inflate::Dynamic block code description: too many length or distance codes`,INVALID_REPEAT_LEN:`inflate::Dynamic block code description: repeat more than specified lengths`,INVALID_REPEAT_FIRST:`inflate::Dynamic block code description: repeat lengths with no first length`,INCOMPLETE_CODES:`inflate::Dynamic block code description: code lengths codes incomplete`,INVALID_DYN_DISTANCE:`inflate::Dynamic block code description: invalid distance code lengths`,INVALID_CODES_LEN:`inflate::Dynamic block code description: invalid literal/length code lengths`,INVALID_STORE_BLOCK:`inflate::Stored block length did not match one's complement`,INVALID_BLOCK_TYPE:`inflate::Invalid block type (type == 3)`,CANT_EXTRACT_FILE:`Could not extract the file`,CANT_OVERRIDE:`Target file already exists`,DISK_ENTRY_TOO_LARGE:`Number of disk entries is too large`,NO_ZIP:`No zip file was loaded`,NO_ENTRY:`Entry doesn't exist`,DIRECTORY_CONTENT_ERROR:`A directory cannot have content`,FILE_NOT_FOUND:`File not found: "{0}"`,NOT_IMPLEMENTED:`Not implemented`,INVALID_FILENAME:`Invalid filename`,INVALID_FORMAT:`Invalid or unsupported zip format. No END header found`,INVALID_PASS_PARAM:`Incompatible password parameter`,WRONG_PASSWORD:`Wrong Password`,COMMENT_TOO_LONG:`Comment is too long`,EXTRA_FIELD_PARSE_ERROR:`Extra field parsing error`};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||``)),/* @__PURE__ */ Error(`ADM-ZIP: `+e)}}for(let r of Object.keys(t))e[r]=n(t[r])})),Sh=/* @__PURE__ */ n(((t,n)=>{let r=e(`fs`),i=e(`path`),a=bh(),o=xh(),s=typeof process==`object`&&process.platform===`win32`,c=e=>typeof e==`object`&&!!e,l=(/* @__PURE__ */ new Uint32Array(256)).map((e,t)=>{for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;return t>>>0});function u(e){this.sep=i.sep,this.fs=r,c(e)&&c(e.fs)&&typeof e.fs.statSync==`function`&&(this.fs=e.fs)}n.exports=u,u.prototype.makeDir=function(e){let t=this;function n(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&e.substr(-1,1)!==`:`){n+=t.sep+e;var r;try{r=t.fs.statSync(n)}catch(e){if(e.message&&e.message.startsWith(`ENOENT`))t.fs.mkdirSync(n);else throw e}if(r&&r.isFile())throw o.FILE_IN_THE_WAY(`"${n}"`)}})}n(e)},u.prototype.writeFileTo=function(e,t,n,r){let a=this;if(a.fs.existsSync(e)&&(!n||a.fs.statSync(e).isDirectory()))return!1;var o=i.dirname(e);a.fs.existsSync(o)||a.makeDir(o);var s;try{s=a.fs.openSync(e,`w`,438)}catch{a.fs.chmodSync(e,438),s=a.fs.openSync(e,`w`,438)}if(s)try{a.fs.writeSync(s,t,0,t.length,0)}finally{a.fs.closeSync(s)}return a.fs.chmodSync(e,r||438),!0},u.prototype.writeFileToAsync=function(e,t,n,r,a){typeof r==`function`&&(a=r,r=void 0);let o=this;o.fs.exists(e,function(s){if(s&&!n)return a(!1);o.fs.stat(e,function(n,c){if(s&&c&&c.isDirectory())return a(!1);var l=i.dirname(e);o.fs.exists(l,function(n){if(!n)try{o.makeDir(l)}catch{return a(!1)}let i=function(n){o.fs.write(n,t,0,t.length,0,function(t){o.fs.close(n,function(){if(t)return a(!1);o.fs.chmod(e,r||438,function(){a(!0)})})})};o.fs.open(e,`w`,438,function(t,n){t?o.fs.chmod(e,438,function(){o.fs.open(e,`w`,438,function(e,t){if(e||!t)return a(!1);i(t)})}):n?i(n):a(!1)})})})})},u.prototype.findFiles=function(e){let t=this;function n(e,r,a,o){typeof r==`boolean`&&(a=r,r=void 0);let s=[];return t.fs.readdirSync(e).forEach(function(c){let l=i.join(e,c),u=t.fs.statSync(l);if((!r||r.test(l))&&s.push(i.normalize(l)+(u.isDirectory()?t.sep:``)),u.isDirectory()&&a){let e=t.fs.realpathSync(l);o.has(e)||(o.add(e),s=s.concat(n(l,r,a,o)))}}),s}return n(e,void 0,!0,/* @__PURE__ */ new Set([t.fs.realpathSync(e)]))},u.prototype.findFilesAsync=function(e,t){let n=this,r=[],a=!1,o=function(e){a||(a=!0,t(e,e?void 0:r))},s=function(e,t,a){n.fs.readdir(e,function(o,c){if(o)return a(o);let l=c.length;if(!l)return a();c.forEach(function(o){let c=i.join(e,o);n.fs.stat(c,function(e,o){if(e)return a(e);o?(r.push(i.normalize(c)+(o.isDirectory()?n.sep:``)),o.isDirectory()?n.fs.realpath(c,function(e,n){if(e)return a(e);t.has(n)?--l||a():(t.add(n),s(c,t,function(e){if(e)return a(e);--l||a()}))}):--l||a()):--l||a()})})})};n.fs.realpath(e,function(t,n){if(t)return o(t);s(e,/* @__PURE__ */ new Set([n]),o)})},u.prototype.getAttributes=function(){},u.prototype.setAttributes=function(){},u.crc32update=function(e,t){return l[(e^t)&255]^e>>>8},u.crc32=function(e){typeof e==`string`&&(e=Buffer.from(e,`utf8`));let t=e.length,n=-1;for(let r=0;r<t;)n=u.crc32update(n,e[r++]);return~n>>>0},u.methodToString=function(e){switch(e){case a.STORED:return`STORED (`+e+`)`;case a.DEFLATED:return`DEFLATED (`+e+`)`;default:return`UNSUPPORTED (`+e+`)`}},u.canonical=function(e){if(!e)return``;let t=i.posix.normalize(`/`+e.split(`\\`).join(`/`));return i.join(`.`,t)},u.zipnamefix=function(e){if(!e)return``;let t=i.posix.normalize(`/`+e.split(`\\`).join(`/`));return i.posix.join(`.`,t)},u.findLast=function(e,t){if(!Array.isArray(e))throw TypeError(`arr is not array`);let n=e.length>>>0;for(let r=n-1;r>=0;r--)if(t(e[r],r,e))return e[r]},u.sanitize=function(e,t){e=i.resolve(i.normalize(e));for(var n=t.split(`/`),r=0,a=n.length;r<a;r++){var o=i.normalize(i.join(e,n.slice(r,a).join(i.sep)));if(o===e||o.startsWith(e+i.sep))return o}return i.normalize(i.join(e,i.basename(t)))},u.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e==`string`?t(e):Buffer.alloc(0)},u.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n},u.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)},u.fromDOS2Date=function(e){return new Date((e>>25&127)+1980,Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(e&31)<<1)},u.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},u.isWin=s,u.crcTable=l})),Ch=/* @__PURE__ */ n(((t,n)=>{let r=e(`path`);n.exports=function(e,{fs:t}){var n=e||``,i=o(),a=null;function o(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return n&&t.existsSync(n)?(a=t.statSync(n),i.directory=a.isDirectory(),i.mtime=a.mtime,i.atime=a.atime,i.executable=!!(73&a.mode),i.readonly=!(128&a.mode),i.hidden=r.basename(n)[0]===`.`):console.warn(`Invalid path: `+n),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:i.directory,isReadOnly:i.readonly,isHidden:i.hidden,isExecutable:i.executable,mTime:i.mtime,aTime:i.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),wh=/* @__PURE__ */ n(((e,t)=>{t.exports={efs:!0,encode:e=>Buffer.from(e,`utf8`),decode:e=>e.toString(`utf8`)}})),Th=/* @__PURE__ */ n(((e,t)=>{t.exports=Sh(),t.exports.Constants=bh(),t.exports.Errors=xh(),t.exports.FileAttr=Ch(),t.exports.decoder=wh()})),Eh=/* @__PURE__ */ n(((e,t)=>{var n=Th(),r=n.Constants;t.exports=function(){var e=20,t=10,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0;e|=n.isWin?2560:768,i|=r.FLG_EFS;let _={extraLen:0},v=e=>Math.max(0,e)>>>0,y=e=>Math.max(0,e)&255;return o=n.fromDate2DOS(/* @__PURE__ */ new Date),{get made(){return e},set made(t){e=t},get version(){return t},set version(e){t=e},get flags(){return i},set flags(e){i=e},get flags_efs(){return(i&r.FLG_EFS)>0},set flags_efs(e){e?i|=r.FLG_EFS:i&=~r.FLG_EFS},get flags_desc(){return(i&r.FLG_DESC)>0},set flags_desc(e){e?i|=r.FLG_DESC:i&=~r.FLG_DESC},get method(){return a},set method(e){switch(e){case r.STORED:this.version=10;break;case r.DEFLATED:default:this.version=20}a=e},get time(){return n.fromDOS2Date(this.timeval)},set time(e){e=new Date(e),this.timeval=n.fromDate2DOS(e)},get timeval(){return o},set timeval(e){o=v(e)},get timeHighByte(){return y(o>>>8)},get crc(){return s},set crc(e){s=v(e)},get compressedSize(){return c},set compressedSize(e){c=v(e)},get size(){return l},set size(e){l=v(e)},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return d},set extraLength(e){d=e},get extraLocalLength(){return _.extraLen},set extraLocalLength(e){_.extraLen=e},get commentLength(){return f},set commentLength(e){f=e},get diskNumStart(){return p},set diskNumStart(e){p=v(e)},get inAttr(){return m},set inAttr(e){m=v(e)},get attr(){return h},set attr(e){h=v(e)},get fileAttr(){return(h||0)>>16&4095},get offset(){return g},set offset(e){g=v(e)},get encrypted(){return(i&r.FLG_ENC)===r.FLG_ENC},get centralHeaderSize(){return r.CENHDR+u+d+f},get realDataOffset(){return g+r.LOCHDR+_.fnameLen+_.extraLen},get localHeader(){return _},loadLocalHeaderFromBinary:function(e){var t=e.slice(g,g+r.LOCHDR);if(t.readUInt32LE(0)!==r.LOCSIG)throw n.Errors.INVALID_LOC();_.version=t.readUInt16LE(r.LOCVER),_.flags=t.readUInt16LE(r.LOCFLG),_.flags_desc=(_.flags&r.FLG_DESC)>0,_.method=t.readUInt16LE(r.LOCHOW),_.time=t.readUInt32LE(r.LOCTIM),_.crc=t.readUInt32LE(r.LOCCRC),_.compressedSize=t.readUInt32LE(r.LOCSIZ),_.size=t.readUInt32LE(r.LOCLEN),_.fnameLen=t.readUInt16LE(r.LOCNAM),_.extraLen=t.readUInt16LE(r.LOCEXT);let i=g+r.LOCHDR+_.fnameLen,a=i+_.extraLen;return e.slice(i,a)},loadFromBinary:function(_){if(_.length!==r.CENHDR||_.readUInt32LE(0)!==r.CENSIG)throw n.Errors.INVALID_CEN();e=_.readUInt16LE(r.CENVEM),t=_.readUInt16LE(r.CENVER),i=_.readUInt16LE(r.CENFLG),a=_.readUInt16LE(r.CENHOW),o=_.readUInt32LE(r.CENTIM),s=_.readUInt32LE(r.CENCRC),c=_.readUInt32LE(r.CENSIZ),l=_.readUInt32LE(r.CENLEN),u=_.readUInt16LE(r.CENNAM),d=_.readUInt16LE(r.CENEXT),f=_.readUInt16LE(r.CENCOM),p=_.readUInt16LE(r.CENDSK),m=_.readUInt16LE(r.CENATT),h=_.readUInt32LE(r.CENATX),g=_.readUInt32LE(r.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(r.LOCHDR);return e.writeUInt32LE(r.LOCSIG,0),e.writeUInt16LE(t,r.LOCVER),e.writeUInt16LE(i&~r.FLG_DESC,r.LOCFLG),e.writeUInt16LE(a,r.LOCHOW),e.writeUInt32LE(o,r.LOCTIM),e.writeUInt32LE(s,r.LOCCRC),e.writeUInt32LE(c,r.LOCSIZ),e.writeUInt32LE(l,r.LOCLEN),e.writeUInt16LE(u,r.LOCNAM),e.writeUInt16LE(_.extraLen,r.LOCEXT),e},centralHeaderToBinary:function(){var n=Buffer.alloc(r.CENHDR+u+d+f);return n.writeUInt32LE(r.CENSIG,0),n.writeUInt16LE(e,r.CENVEM),n.writeUInt16LE(t,r.CENVER),n.writeUInt16LE(i&~r.FLG_DESC,r.CENFLG),n.writeUInt16LE(a,r.CENHOW),n.writeUInt32LE(o,r.CENTIM),n.writeUInt32LE(s,r.CENCRC),n.writeUInt32LE(c,r.CENSIZ),n.writeUInt32LE(l,r.CENLEN),n.writeUInt16LE(u,r.CENNAM),n.writeUInt16LE(d,r.CENEXT),n.writeUInt16LE(f,r.CENCOM),n.writeUInt16LE(p,r.CENDSK),n.writeUInt16LE(m,r.CENATT),n.writeUInt32LE(h,r.CENATX),n.writeUInt32LE(g,r.CENOFF),n},toJSON:function(){let o=function(e){return e+` bytes`};return{made:e,version:t,flags:i,method:n.methodToString(a),time:this.time,crc:`0x`+s.toString(16).toUpperCase(),compressedSize:o(c),size:o(l),fileNameLength:o(u),extraLength:o(d),commentLength:o(f),diskNumStart:p,inAttr:m,attr:h,offset:g,centralHeaderSize:o(r.CENHDR+u+d+f)}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),Dh=/* @__PURE__ */ n(((e,t)=>{var n=Th(),r=n.Constants;t.exports=function(){var e=0,t=0,i=0,a=0,o=0;let s=()=>e>r.EF_ZIP64_OR_16||t>r.EF_ZIP64_OR_16||i>r.EF_ZIP64_OR_32||a>r.EF_ZIP64_OR_32;return{get diskEntries(){return e},set diskEntries(n){e=t=n},get totalEntries(){return t},set totalEntries(n){t=e=n},get size(){return i},set size(e){i=e},get offset(){return a},set offset(e){a=e},get commentLength(){return o},set commentLength(e){o=e},get mainHeaderSize(){return(s()?r.ZIP64HDR+r.END64HDR:0)+r.ENDHDR+o},loadFromBinary:function(s){if((s.length!==r.ENDHDR||s.readUInt32LE(0)!==r.ENDSIG)&&(s.length<r.ZIP64HDR||s.readUInt32LE(0)!==r.ZIP64SIG))throw n.Errors.INVALID_END();s.readUInt32LE(0)===r.ENDSIG?(e=s.readUInt16LE(r.ENDSUB),t=s.readUInt16LE(r.ENDTOT),i=s.readUInt32LE(r.ENDSIZ),a=s.readUInt32LE(r.ENDOFF),o=s.readUInt16LE(r.ENDCOM)):(e=n.readBigUInt64LE(s,r.ZIP64SUB),t=n.readBigUInt64LE(s,r.ZIP64TOT),i=n.readBigUInt64LE(s,r.ZIP64SIZB),a=n.readBigUInt64LE(s,r.ZIP64OFF),o=0)},toBinary:function(){if(!s()){var c=Buffer.alloc(r.ENDHDR+o);return c.writeUInt32LE(r.ENDSIG,0),c.writeUInt32LE(0,4),c.writeUInt16LE(e,r.ENDSUB),c.writeUInt16LE(t,r.ENDTOT),c.writeUInt32LE(i,r.ENDSIZ),c.writeUInt32LE(a,r.ENDOFF),c.writeUInt16LE(o,r.ENDCOM),c.fill(` `,r.ENDHDR),c}var c=Buffer.alloc(this.mainHeaderSize);let l=0;c.writeUInt32LE(r.ZIP64SIG,l),n.writeBigUInt64LE(c,r.ZIP64HDR-r.ZIP64LEAD,l+r.ZIP64SIZE),c.writeUInt16LE(45,l+r.ZIP64VEM),c.writeUInt16LE(45,l+r.ZIP64VER),c.writeUInt32LE(0,l+r.ZIP64DSK),c.writeUInt32LE(0,l+r.ZIP64DSKDIR),n.writeBigUInt64LE(c,e,l+r.ZIP64SUB),n.writeBigUInt64LE(c,t,l+r.ZIP64TOT),n.writeBigUInt64LE(c,i,l+r.ZIP64SIZB),n.writeBigUInt64LE(c,a,l+r.ZIP64OFF);let u=a+i;return l+=r.ZIP64HDR,c.writeUInt32LE(r.END64SIG,l),c.writeUInt32LE(0,l+r.END64START),n.writeBigUInt64LE(c,u,l+r.END64OFF),c.writeUInt32LE(1,l+r.END64NUMDISKS),l+=r.END64HDR,c.writeUInt32LE(r.ENDSIG,l),c.writeUInt32LE(0,l+4),c.writeUInt16LE(Math.min(e,r.EF_ZIP64_OR_16),l+r.ENDSUB),c.writeUInt16LE(Math.min(t,r.EF_ZIP64_OR_16),l+r.ENDTOT),c.writeUInt32LE(Math.min(i,r.EF_ZIP64_OR_32),l+r.ENDSIZ),c.writeUInt32LE(Math.min(a,r.EF_ZIP64_OR_32),l+r.ENDOFF),c.writeUInt16LE(o,l+r.ENDCOM),c.fill(` `,l+r.ENDHDR),c},toJSON:function(){return{diskEntries:e,totalEntries:t,size:i+` bytes`,offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n=`0`+n;return`0x`+n}(a,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),Oh=/* @__PURE__ */ n((e=>{e.EntryHeader=Eh(),e.MainHeader=Dh()})),kh=/* @__PURE__ */ n(((t,n)=>{n.exports=function(t){var n=e(`zlib`),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return n.deflateRawSync(t,r)},deflateAsync:function(e){var i=n.createDeflateRaw(r),a=[],o=0;i.on(`data`,function(e){a.push(e),o+=e.length}),i.on(`end`,function(){var t=Buffer.alloc(o),n=0;t.fill(0);for(var r=0;r<a.length;r++){var i=a[r];i.copy(t,n),n+=i.length}e&&e(t)}),i.end(t)}}}})),Ah=/* @__PURE__ */ n(((t,n)=>{let r=+(process?.versions?.node??``).split(`.`)[0]||0;n.exports=function(t,n){var i=e(`zlib`);let a=r>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return i.inflateRawSync(t,a)},inflateAsync:function(e){var n=i.createInflateRaw(a),r=[],o=0;n.on(`data`,function(e){r.push(e),o+=e.length}),n.on(`end`,function(){var t=Buffer.alloc(o),n=0;t.fill(0);for(var i=0;i<r.length;i++){var a=r[i];a.copy(t,n),n+=a.length}e&&e(t)}),n.end(t)}}}})),jh=/* @__PURE__ */ n(((t,n)=>{let{randomFillSync:r}=e(`crypto`),i=xh(),a=(/* @__PURE__ */ new Uint32Array(256)).map((e,t)=>{for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t>>>=1;return t>>>0}),o=(e,t)=>Math.imul(e,t)>>>0,s=(e,t)=>a[(e^t)&255]^e>>>8,c=()=>typeof r==`function`?r(Buffer.alloc(12)):c.node();c.node=()=>{let e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=Math.random()*256&255;return e};let l={genSalt:c};function u(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}u.prototype.updateKeys=function(e){let t=this.keys;return t[0]=s(t[0],e),t[1]+=t[0]&255,t[1]=o(t[1],134775813)+1,t[2]=s(t[2],t[1]>>>24),e},u.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return o(e,e^1)>>8&255};function d(e){let t=new u(e);return function(e){let n=Buffer.alloc(e.length),r=0;for(let i of e)n[r++]=t.updateKeys(i^t.next());return n}}function f(e){let t=new u(e);return function(e,n,r=0){n||=Buffer.alloc(e.length);for(let i of e){let e=t.next();n[r++]=i^e,t.updateKeys(i)}return n}}function p(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=d(n),a=r(e.slice(0,12)),o=(t.flags&8)==8?t.timeHighByte:t.crc>>>24;if(a[11]!==o)throw i.WRONG_PASSWORD();return r(e.slice(12))}function m(e){Buffer.isBuffer(e)&&e.length>=12?l.genSalt=function(){return e.slice(0,12)}:e===`node`?l.genSalt=c.node:l.genSalt=c}function h(e,t,n,r=!1){e??=Buffer.alloc(0),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=f(n),a=l.genSalt();a[11]=t.crc>>>24&255,r&&(a[10]=t.crc>>>16&255);let o=Buffer.alloc(e.length+12);return i(a,o),i(e,o,12)}n.exports={decrypt:p,encrypt:h,_salter:m}})),Mh=/* @__PURE__ */ n((e=>{e.Deflater=kh(),e.Inflater=Ah(),e.ZipCrypto=jh()})),Nh=/* @__PURE__ */ n(((e,t)=>{var n=Th(),r=Oh(),i=n.Constants,a=Mh();t.exports=function(e,t){var o=new r.EntryHeader,s=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,u=null,d=Buffer.alloc(0),f=Buffer.alloc(0),p=!0;let m=e,h=typeof m.decoder==`object`?m.decoder:n.decoder;p=h.hasOwnProperty(`efs`)?h.efs:!1;function g(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(f=o.loadLocalHeaderFromBinary(t),t.slice(o.realDataOffset,o.realDataOffset+o.compressedSize))}function _(e){let t=o.flags_desc||o.localHeader.flags_desc?o.crc:o.localHeader.crc;return n.crc32(e)===t}function v(e,t,r){if(t===void 0&&typeof e==`string`&&(r=e,e=void 0),l)return e&&t&&t(Buffer.alloc(0),n.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var i=g();if(i.length===0)return e&&t&&t(i),i;if(o.encrypted){if(typeof r!=`string`&&!Buffer.isBuffer(r))throw n.Errors.INVALID_PASS_PARAM();i=a.ZipCrypto.decrypt(i,o,r)}var c;switch(o.method){case n.Constants.STORED:if(c=Buffer.alloc(i.length),i.copy(c),_(c))return e&&t&&t(c),c;throw e&&t&&t(c,n.Errors.BAD_CRC()),n.Errors.BAD_CRC();case n.Constants.DEFLATED:var u=new a.Inflater(i,o.size);if(e)u.inflateAsync(function(e){t&&(_(e)?t(e):t(e,n.Errors.BAD_CRC()))});else{if(c=u.inflate(),!_(c))throw n.Errors.BAD_CRC(`"${h.decode(s)}"`);return c}break;default:throw e&&t&&t(Buffer.alloc(0),n.Errors.UNKNOWN_METHOD()),n.Errors.UNKNOWN_METHOD()}}function y(e,r){if((!u||!u.length)&&Buffer.isBuffer(t))return e&&r&&r(g()),g();if(u.length&&!l){var i;switch(o.method){case n.Constants.STORED:return o.compressedSize=o.size,i=Buffer.alloc(u.length),u.copy(i),e&&r&&r(i),i;default:case n.Constants.DEFLATED:var s=new a.Deflater(u);if(e)s.deflateAsync(function(e){i=Buffer.alloc(e.length),o.compressedSize=e.length,e.copy(i),r&&r(i)});else{var c=s.deflate();return o.compressedSize=c.length,c}s=null}}else if(e&&r)r(Buffer.alloc(0));else return Buffer.alloc(0)}function b(e,t){return n.readBigUInt64LE(e,t)}function x(e){try{for(var t=0,r,a,o;t+4<e.length;)r=e.readUInt16LE(t),t+=2,a=e.readUInt16LE(t),t+=2,o=e.slice(t,t+a),t+=a,i.ID_ZIP64===r&&S(o)}catch{throw n.Errors.EXTRA_FIELD_PARSE_ERROR()}}function S(e){var t,n,r,a;e.length>=i.EF_ZIP64_SCOMP&&(t=b(e,i.EF_ZIP64_SUNCOMP),o.size===i.EF_ZIP64_OR_32&&(o.size=t)),e.length>=i.EF_ZIP64_RHO&&(n=b(e,i.EF_ZIP64_SCOMP),o.compressedSize===i.EF_ZIP64_OR_32&&(o.compressedSize=n)),e.length>=i.EF_ZIP64_DSN&&(r=b(e,i.EF_ZIP64_RHO),o.offset===i.EF_ZIP64_OR_32&&(o.offset=r)),e.length>=i.EF_ZIP64_DSN+4&&(a=e.readUInt32LE(i.EF_ZIP64_DSN),o.diskNumStart===i.EF_ZIP64_OR_16&&(o.diskNumStart=a))}return{get entryName(){return h.decode(s)},get rawEntryName(){return s},set entryName(e){s=n.toBuffer(e,h.encode);var t=s[s.length-1];l=t===47||t===92,o.fileNameLength=s.length},get efs(){return typeof p==`function`?p(this.entryName):p},get extra(){return d},set extra(e){d=e,o.extraLength=e.length,x(e)},get comment(){return h.decode(c)},set comment(e){if(c=n.toBuffer(e,h.encode),o.commentLength=c.length,c.length>65535)throw n.Errors.COMMENT_TOO_LONG()},get name(){let e=h.decode(s);return l?e.replace(/[/\\]$/,``).split(`/`).pop():e.split(`/`).pop()},get isDirectory(){return l},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(e){y(!0,e)},setData:function(e){u=n.toBuffer(e,n.decoder.encode),!l&&u.length?(o.size=u.length,o.method=n.Constants.DEFLATED,o.crc=n.crc32(e),o.changed=!0):o.method=n.Constants.STORED},getData:function(e){return o.changed?u:v(!1,null,e)},getDataAsync:function(e,t){o.changed?e(u):v(!0,e,t)},set attr(e){o.attr=e},get attr(){return o.attr},set header(e){o.loadFromBinary(e)},get header(){return o},packCentralHeader:function(){o.flags_efs=this.efs,o.extraLength=d.length;var e=o.centralHeaderToBinary(),t=n.Constants.CENHDR;return s.copy(e,t),t+=s.length,d.copy(e,t),t+=o.extraLength,c.copy(e,t),e},packLocalHeader:function(){let e=0;o.flags_efs=this.efs,o.extraLocalLength=f.length;let t=o.localHeaderToBinary(),n=Buffer.alloc(t.length+s.length+o.extraLocalLength);return t.copy(n,e),e+=t.length,s.copy(n,e),e+=s.length,f.copy(n,e),e+=f.length,n},toJSON:function(){let e=function(e){return`<`+(e&&e.length+` bytes buffer`||`null`)+`>`};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:o.toJSON(),compressedData:e(t),data:e(u)}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),Ph=/* @__PURE__ */ n(((e,t)=>{let n=Nh(),r=Oh(),i=Th();t.exports=function(e,t){var a=[],o=Object.create(null),s=Buffer.alloc(0),c=new r.MainHeader,l=!1;let u=/* @__PURE__ */ new Set,d=t,{noSort:f,decoder:p}=d;e?g(d.readEntries):l=!0;function m(){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(o)){let n=t.split(`/`);if(n.pop(),n.length)for(let t=0;t<n.length;t++){let r=n.slice(0,t+1).join(`/`)+`/`;e.add(r)}}for(let t of e)if(!(t in o)){let e=new n(d);e.entryName=t,e.attr=16,e.temporary=!0,a.push(e),o[e.entryName]=e,u.add(e)}}function h(){if(l=!0,o=Object.create(null),c.diskEntries>(e.length-c.offset)/i.Constants.CENHDR)throw i.Errors.DISK_ENTRY_TOO_LARGE();a=Array(c.diskEntries);for(var t=c.offset,r=0;r<a.length;r++){var s=t,f=new n(d,e);f.header=e.slice(s,s+=i.Constants.CENHDR),f.entryName=e.slice(s,s+=f.header.fileNameLength),f.header.extraLength&&(f.extra=e.slice(s,s+=f.header.extraLength)),f.header.commentLength&&(f.comment=e.slice(s,s+f.header.commentLength)),t+=f.header.centralHeaderSize,a[r]=f,o[f.entryName]=f}u.clear(),m()}function g(t){var n=e.length-i.Constants.ENDHDR,r=Math.max(0,n-65535),a=r,o=e.length,l=-1,u=0;for(typeof d.trailingSpace==`boolean`&&d.trailingSpace&&(r=0);n>=a;n--)if(e[n]===80){if(e.readUInt32LE(n)===i.Constants.ENDSIG)l=n,u=n,o=n+i.Constants.ENDHDR,a=n-i.Constants.END64HDR;else if(e.readUInt32LE(n)===i.Constants.END64SIG)a=r;else if(e.readUInt32LE(n)===i.Constants.ZIP64SIG){l=n,o=n+i.readBigUInt64LE(e,n+i.Constants.ZIP64SIZE)+i.Constants.ZIP64LEAD;break}}if(l==-1)throw i.Errors.INVALID_FORMAT();c.loadFromBinary(e.slice(l,o)),c.commentLength&&(s=e.slice(u+i.Constants.ENDHDR)),t&&h()}function _(){a.length>1&&!f&&(a=a.map(e=>({entry:e,key:e.entryName.toLowerCase()})).sort((e,t)=>e.key.localeCompare(t.key)).map(e=>e.entry))}return{get entries(){return l||h(),a.filter(e=>!u.has(e))},get comment(){return p.decode(s)},set comment(e){s=i.toBuffer(e,p.encode),c.commentLength=s.length},getEntryCount:function(){return l?a.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||h(),o[e]||null},setEntry:function(e){l||h(),a.push(e),o[e.entryName]=e,c.totalEntries=a.length},deleteFile:function(e,t=!0){l||h();let n=o[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||h();let t=o[e],n=a.indexOf(t);n>=0&&(a.splice(n,1),delete o[e],c.totalEntries=a.length)},getEntryChildren:function(e,t=!0){if(l||h(),typeof e==`object`){if(e.isDirectory&&t){let t=[],n=e.entryName;for(let e of a)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){let t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||h(),_();let t=[],n=[],r=0,i=0;c.size=0,c.offset=0;let a=0;for(let e of this.entries){let o=e.getCompressedData();e.header.offset=i;let s=e.packLocalHeader(),l=s.length+o.length;i+=l,t.push(s),t.push(o);let u=e.packCentralHeader();n.push(u),c.size+=u.length,r+=l+u.length,a++}r+=c.mainHeaderSize,c.offset=i,c.totalEntries=a,i=0;let o=Buffer.alloc(r);for(let e of t)e.copy(o,i),i+=e.length;for(let e of n)e.copy(o,i),i+=e.length;let u=c.toBinary();return s&&s.copy(u,u.length-s.length),u.copy(o,i),e=o,l=!1,o},toAsyncBuffer:function(t,n,r,i){try{l||h(),_();let n=[],a=[],o=0,u=0,d=0;c.size=0,c.offset=0;let f=function(p){if(p.length>0){let e=p.shift(),t=e.entryName+e.extra.toString();r&&r(t),e.getCompressedDataAsync(function(r){i&&i(t),e.header.offset=u;let s=e.packLocalHeader(),l=s.length+r.length;u+=l,n.push(s),n.push(r);let m=e.packCentralHeader();a.push(m),c.size+=m.length,o+=l+m.length,d++,f(p)})}else{o+=c.mainHeaderSize,c.offset=u,c.totalEntries=d,u=0;let r=Buffer.alloc(o);n.forEach(function(e){e.copy(r,u),u+=e.length}),a.forEach(function(e){e.copy(r,u),u+=e.length});let i=c.toBinary();s&&s.copy(i,i.length-s.length),i.copy(r,u),e=r,l=!1,t(r)}};f(Array.from(this.entries))}catch(e){n(e)}}}}})),Fh=/* @__PURE__ */ t((/* @__PURE__ */ n(((t,n)=>{let r=Th(),i=e(`path`),a=Nh(),o=Ph(),s=(...e)=>r.findLast(e,e=>typeof e==`boolean`),c=(...e)=>r.findLast(e,e=>typeof e==`string`),l=(...e)=>r.findLast(e,e=>typeof e==`function`),u={noSort:!1,readEntries:!1,method:r.Constants.NONE,fs:null};n.exports=function(e,t){let n=null,d=Object.assign(Object.create(null),u);e&&typeof e==`object`&&(e instanceof Uint8Array||(Object.assign(d,e),e=d.input?d.input:void 0,d.input&&delete d.input),Buffer.isBuffer(e)&&(n=e,d.method=r.Constants.BUFFER,e=void 0)),Object.assign(d,t);let f=new r(d),p=e=>{e.filter(e=>e.attr).sort((e,t)=>t.path.length-e.path.length).forEach(e=>f.fs.chmodSync(e.path,e.attr))};if((typeof d.decoder!=`object`||typeof d.decoder.encode!=`function`||typeof d.decoder.decode!=`function`)&&(d.decoder=r.decoder),e&&typeof e==`string`){if(f.fs.existsSync(e))d.method=r.Constants.FILE,d.filename=e,n=f.fs.readFileSync(e);else throw r.Errors.INVALID_FILENAME()}let m=new o(n,d),{canonical:h,sanitize:g,zipnamefix:_}=r;function v(e){if(e&&m){var t;if(typeof e==`string`&&(t=m.getEntry(i.posix.normalize(e))),typeof e==`object`&&e.entryName!==void 0&&e.header!==void 0&&(t=m.getEntry(e.entryName)),t)return t}return null}function y(e){let{join:t,normalize:n,sep:r}=i.posix;return t(i.isAbsolute(e)?`/`:`.`,n(r+e.split(`\\`).join(r)+r))}function b(e){return e instanceof RegExp?(function(e){return function(t){return e.test(t)}})(e):typeof e==`function`?e:()=>!0}let x=(e,t)=>{let n=t.slice(-1);return n=n===f.sep?f.sep:``,i.relative(e,t)+n};return{readFile:function(e,t){var n=v(e);return n&&n.getData(t)||null},childCount:function(e){let t=v(e);if(t)return m.getChildCount(t)},readFileAsync:function(e,t){var n=v(e);n?n.getDataAsync(t):t(null,`getEntry failed for:`+e)},readAsText:function(e,t){var n=v(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||`utf8`)}return``},readAsTextAsync:function(e,t,n){var r=v(e);r?r.getDataAsync(function(e,r){r?t(e,r):e&&e.length?t(e.toString(n||`utf8`)):t(``)}):t(``)},deleteFile:function(e,t=!0){var n=v(e);n&&m.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=v(e);t&&m.deleteEntry(t.entryName)},addZipComment:function(e){m.comment=e},getZipComment:function(){return m.comment||``},addZipEntryComment:function(e,t){var n=v(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=v(e);return t&&t.comment||``},updateFile:function(e,t){var n=v(e);n&&n.setData(t)},addLocalFile:function(e,t,n,a){if(f.fs.existsSync(e)){t=t?y(t):``;let r=i.win32.basename(i.win32.normalize(e));t+=n||r;let o=f.fs.statSync(e),s=o.isFile()?f.fs.readFileSync(e):Buffer.alloc(0);o.isDirectory()&&(t+=f.sep),this.addFile(t,s,a,o)}else throw r.Errors.FILE_NOT_FOUND(e)},addLocalFileAsync:function(e,t){e=typeof e==`object`?e:{localPath:e};let n=i.resolve(e.localPath),{comment:r}=e,{zipPath:a,zipName:o}=e,s=this;f.fs.stat(n,function(e,c){if(e)return t(e,!1);a=a?y(a):``;let l=i.win32.basename(i.win32.normalize(n));if(a+=o||l,c.isFile())f.fs.readFile(n,function(e,n){return e?t(e,!1):(s.addFile(a,n,r,c),setImmediate(t,void 0,!0))});else if(c.isDirectory())return a+=f.sep,s.addFile(a,Buffer.alloc(0),r,c),setImmediate(t,void 0,!0)})},addLocalFolder:function(e,t,n){if(n=b(n),t=t?y(t):``,e=i.normalize(e),f.fs.existsSync(e)){let r=f.findFiles(e),a=this;if(r.length)for(let o of r){let r=i.join(t,x(e,o));n(r)&&a.addLocalFile(o,i.dirname(r))}}else throw r.Errors.FILE_NOT_FOUND(e)},addLocalFolderAsync:function(e,t,n,a){a=b(a),n=n?y(n):``,e=i.normalize(e);var o=this;f.fs.open(e,`r`,function(i){if(i&&i.code===`ENOENT`)t(void 0,r.Errors.FILE_NOT_FOUND(e));else if(i)t(void 0,i);else{var s=f.findFiles(e),c=-1,l=function(){if(c+=1,c<s.length){var r=s[c],i=x(e,r).split(`\\`).join(`/`);i=i.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\x20-\x7E]/g,``),a(i)?f.fs.stat(r,function(e,a){e&&t(void 0,e),a.isFile()?f.fs.readFile(r,function(e,r){e?t(void 0,e):(o.addFile(n+i,r,``,a),l())}):(o.addFile(n+i+`/`,Buffer.alloc(0),``,a),l())}):process.nextTick(()=>{l()})}else t(!0,void 0)};l()}})},addLocalFolderAsync2:function(e,t){let n=this;e=typeof e==`object`?e:{localPath:e};let a=i.resolve(y(e.localPath)),{zipPath:o,filter:s,namefix:c}=e;s instanceof RegExp?s=(function(e){return function(t){return e.test(t)}})(s):typeof s!=`function`&&(s=function(){return!0}),o=o?y(o):``,c===`latin1`&&(c=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\x20-\x7E]/g,``)),typeof c!=`function`&&(c=e=>e);let l=e=>i.join(o,c(x(a,e))),u=e=>i.win32.basename(i.win32.normalize(c(e)));f.fs.open(a,`r`,function(e){e&&e.code===`ENOENT`?t(void 0,r.Errors.FILE_NOT_FOUND(a)):e?t(void 0,e):f.findFilesAsync(a,function(e,r){if(e)return t(e);r=r.filter(e=>s(l(e))),r.length||t(void 0,!1),setImmediate(r.reverse().reduce(function(e,t){return function(r,a){if(r||a===!1)return setImmediate(e,r,!1);n.addLocalFileAsync({localPath:t,zipPath:i.dirname(l(t)),zipName:u(t)},e)}},t))})})},addLocalFolderPromise:function(e,t){return new Promise((n,r)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&r(e),t&&n(this)})})},addFile:function(e,t,n,r){e=_(e);let i=v(e),o=i!=null;o||(i=new a(d),i.entryName=e),i.comment=n||``;let s=typeof r==`object`&&r instanceof f.fs.Stats;s&&(i.header.time=r.mtime);var c=i.isDirectory?16:0;let l=i.isDirectory?16384:32768;return l|=s?4095&r.mode:typeof r==`number`?4095&r:i.isDirectory?493:420,c=(c|l<<16)>>>0,i.attr=c,i.setData(t),o||m.setEntry(i),i},getEntries:function(e){return m.password=e,m?m.entries:[]},getEntry:function(e){return v(e)},getEntryCount:function(){return m.getEntryCount()},forEach:function(e){return m.forEach(e)},extractEntryTo:function(e,t,n,a,o,l){a=s(!1,a),o=s(!1,o),n=s(!0,n),l=c(o,l);var u=v(e);if(!u)throw r.Errors.NO_ENTRY();var d=h(u.entryName),p=g(t,l&&!u.isDirectory?h(l):n?d:i.basename(d));if(u.isDirectory)return m.getEntryChildren(u).forEach(function(e){if(e.isDirectory)return;var i=e.getData();if(!i)throw r.Errors.CANT_EXTRACT_FILE();var s=h(n?e.entryName:e.entryName.substring(u.entryName.length)),c=g(t,s);let l=o?e.header.fileAttr:void 0;f.writeFileTo(c,i,a,l)}),!0;var _=u.getData(m.password);if(!_)throw r.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(p)&&!a)throw r.Errors.CANT_OVERRIDE();let y=o?e.header.fileAttr:void 0;return f.writeFileTo(p,_,a,y),!0},test:function(e){if(!m)return!1;for(var t of m.entries)try{if(t.isDirectory)continue;if(!t.getData(e))return!1}catch{return!1}return!0},extractAllTo:function(e,t,n,i){if(n=s(!1,n),i=c(n,i),t=s(!1,t),!m)throw r.Errors.NO_ZIP();let a=[];m.entries.forEach(function(o){var s=g(e,h(o.entryName));if(o.isDirectory){f.makeDir(s),n&&a.push({path:s,attr:o.header.fileAttr});return}var c=o.getData(i);if(!c)throw r.Errors.CANT_EXTRACT_FILE();let l=n?o.header.fileAttr:void 0;f.writeFileTo(s,c,t,l);try{f.fs.utimesSync(s,o.header.time,o.header.time)}catch{}}),p(a)},extractAllToAsync:function(e,t,n,a){if(a=l(t,n,a),n=s(!1,n),t=s(!1,t),!a)return new Promise((r,i)=>{this.extractAllToAsync(e,t,n,function(e){e?i(e):r(this)})});if(!m){a(r.Errors.NO_ZIP());return}e=i.resolve(e);let o=t=>g(e,i.normalize(h(t.entryName))),c=(e,t)=>/* @__PURE__ */ Error(e+`: "`+t+`"`),u=[],d=[];m.entries.forEach(e=>{e.isDirectory?u.push(e):d.push(e)});let _=[];for(let e of u){let t=o(e),r=n?e.header.fileAttr:void 0;try{f.makeDir(t)}catch{a(c(`Unable to create folder`,t));continue}r&&_.push({path:t,attr:r});try{f.fs.utimesSync(t,e.header.time,e.header.time)}catch{}}d.reverse().reduce(function(a,o){return function(s){if(s)a(s);else{let s=i.normalize(h(o.entryName)),l=g(e,s);o.getDataAsync(function(e,i){if(i)a(i);else if(!e)a(r.Errors.CANT_EXTRACT_FILE());else{let r=n?o.header.fileAttr:void 0;f.writeFileToAsync(l,e,t,r,function(e){if(!e)return a(c(`Unable to write file`,l));f.fs.utimes(l,o.header.time,o.header.time,function(){a()})})}})}}},e=>{if(!e)try{p(_)}catch(e){return a(c(`Unable to set folder permissions`,e.path||``))}a(e)})()},writeZip:function(e,t){if(arguments.length===1&&typeof e==`function`&&(t=e,e=``),!e&&d.filename&&(e=d.filename),e){var n=m.compressToBuffer();if(n){var r=f.writeFileTo(e,n,!0);typeof t==`function`&&t(r?null:/* @__PURE__ */ Error(`failed`),``)}}},writeZipPromise:function(e,t){let{overwrite:n,perm:r}=Object.assign({overwrite:!0},t);return new Promise((t,i)=>{!e&&d.filename&&(e=d.filename),e||i(`ADM-ZIP: ZIP File Name Missing`),this.toBufferPromise().then(a=>{f.writeFileToAsync(e,a,n,r,e=>e?t(e):i(`ADM-ZIP: Wasn't able to write zip file`))},i)})},toBufferPromise:function(){return new Promise((e,t)=>{m.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,r){return typeof e==`function`?(m.toAsyncBuffer(e,t,n,r),null):m.compressToBuffer()}}}})))(),1),Ih=/* @__PURE__ */ t(St(),1),Lh=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const Rh=`mintlify`,zh=`templates`,Bh=`main`;function Vh(){return Lh(this,void 0,void 0,function*(){let e=yield fetch(`https://api.github.com/repos/${Rh}/${zh}/contents/?ref=${Bh}`,{headers:{Accept:`application/vnd.github.v3+json`}});if(!e.ok)throw Error(`Failed to fetch templates: ${e.status} ${e.statusText}`);return(yield e.json()).filter(e=>e.type===`dir`).map(e=>e.name)})}function Hh(e){return Lh(this,void 0,void 0,function*(){if(!e||e===`.`||e===`..`||e.includes(`/`))throw Error(`Invalid template name: "${e}".`);let t=`https://api.github.com/repos/${Rh}/${zh}/contents/${encodeURIComponent(e)}?ref=${Bh}`,n=yield fetch(t,{headers:{Accept:`application/vnd.github.v3+json`}});if(!n.ok){let t=yield Vh().catch(()=>[]),n=t.length>0?` Available templates: ${t.join(`, `)}`:``;throw Error(`Template "${e}" not found in ${Rh}/${zh}.${n}`)}if(!(yield n.json()).some(e=>e.name===`docs.json`))throw Error(`Template "${e}" is not a valid Mintlify template (missing docs.json).`);return e})}function Uh(){return Lh(this,void 0,void 0,function*(){D((0,P.jsx)(f,{message:`fetching available templates...`}));let e;try{e=yield Vh()}catch{throw a(),Error(`Failed to fetch templates. Please check your network connection and try again.`)}if(a(),e.length===0)throw Error(`No templates are currently available.`);return Zd({message:`Choose a template`,choices:e.map(e=>({name:e,value:e}))})})}function Wh(e,t,n,r){return Lh(this,void 0,void 0,function*(){let i=jn.join(e,`__template__.zip`),o=jn.join(e,`__template_extract__`);try{D((0,P.jsx)(f,{message:`downloading template "${t}"...`}));try{let e=yield fetch(`https://github.com/${Rh}/${zh}/archive/refs/heads/${Bh}.zip`);if(!e.ok)throw Error(`Failed to download templates archive: ${e.status}`);let t=yield e.arrayBuffer();yield Ih.default.writeFile(i,Buffer.from(t))}finally{a()}D((0,P.jsx)(f,{message:`extracting template...`}));try{new Fh.default(i).extractAllTo(o,!0)}finally{a()}let n=jn.join(o,`${zh}-${Bh}`),r=jn.join(n,t);if(!(yield Ih.default.pathExists(r)))throw Error(`Template directory "${t}" not found in the downloaded archive.`);yield Ih.default.copy(r,e,{overwrite:!0})}finally{yield Ih.default.remove(i).catch(()=>{}),yield Ih.default.remove(o).catch(()=>{})}let s=jn.join(e,`docs.json`);if(yield Ih.default.pathExists(s)){let e=yield Ih.default.readJson(s);n&&(e.name=n),r&&(e.theme=r),yield Ih.default.writeJson(s,e,{spaces:2})}})}var Gh=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const Kh=e=>{h((0,P.jsx)(M,{bold:!0,children:`Documentation Setup!`}),(0,P.jsx)(M,{children:`To see your docs run`}),(0,P.jsxs)(ke,{children:[(0,P.jsx)(M,{color:`blue`,children:`cd`}),(0,P.jsxs)(M,{children:[` `,e]})]}),(0,P.jsx)(M,{color:`blue`,children:`mint dev`})),Je()&&D((0,P.jsxs)(M,{children:["When the docs are ready, run `mint validate` in ",e,` to check the build and get publish steps.`]}))},qh=(e,t,n,r)=>{let i=r===void 0?`Unable to fetch templates — use --template flag if you know the name`:r.length>0?`Templates: ${JSON.stringify(r)}`:`No templates are currently available`;h((0,P.jsx)(M,{children:`Agent Detected - sending AI friendly prompt`}),(0,P.jsx)(M,{children:`<system-message>`}),(0,P.jsx)(M,{children:"Help the user set up a Mintlify docs site with `mint new`. Ask each step one at a time unless the user asks you to skip questions or use your best judgment."}),(0,P.jsx)(M,{children:[`- [ ] Pick a theme or clone a template? (${i})`,`- [ ] If template: which one? If theme: which one? (Themes: ${JSON.stringify(n)})`,`- [ ] Project name?`,`- [ ] Directory? (default: "${e}", auto-created if needed)${t?` ⚠️ "${e}" is occupied — subdirectory, overwrite (--force), or different path?`:``}`].join(`
555
+ `)}var ch=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const lh=[`bug`,`docs`,`idea`];function uh(e){return ch(this,void 0,void 0,function*(){let t;try{t=yield fetch(`${rt}/api/cli/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(Object.assign(Object.assign({},e),{source:`cli`}))})}catch{return`could not reach the server`}return t.ok?void 0:`could not send feedback (HTTP ${t.status})`})}function dh(e){return ch(this,void 0,void 0,function*(){let t=yield uh(e);return D(t?(0,P.jsx)(c,{message:t}):(0,P.jsx)(o,{message:`feedback sent`})),!t})}var fh=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},ph=function(e){return this instanceof ph?(this.v=e,this):new ph(e)},mh=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},hh=function(e){var t={},n;return r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:ph(e[r](t)),done:!1}:i?i(t):t}:i}},gh=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof ph?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function _h(){return fh(this,void 0,void 0,function*(){try{let e=yield Wn.readFile(Rn.join(et,`.gitignore`),`utf-8`);return le(e)}catch{return[]}})}function vh(e,t){return gh(this,arguments,function*(){let n=yield ph(Wn.readdir(e,{withFileTypes:!0}));for(let r of n){let n=Rn.join(e,r.name),i=Rn.relative(et,n).split(Rn.sep).join(`/`);De(i,t,r.isDirectory())||(r.isDirectory()?yield ph(yield*hh(mh(vh(n,t)))):r.name.endsWith(`.mdx`)&&(yield yield ph(n)))}})}const yh=()=>fh(void 0,void 0,void 0,function*(){var e,t,n,r;let{mdxToPm:i,pmToMdx:a,canonicalPmToMdxOptions:s}=yield import(`./converter-B97mJc5W.js`),l=[...yield _h(),...yield ge(et)],u=ce(l),d=0,f=0,p=0;try{for(var m=!0,h=mh(vh(et,u)),g;g=yield h.next(),e=g.done,!e;m=!0){r=g.value,m=!1;let e=r;d++;let t=Rn.relative(et,e);try{let t=yield Wn.readFile(e,`utf-8`),n=t,r=0;for(let e=0;e<3;e++){let{doc:t,frontmatter:o}=i(n);e===0&&(r=Object.keys(o).length);let c=`${a(t,Object.assign({frontmatter:o},s))}\n`;if(c===n)break;n=c}if(r>0&&!n.startsWith(`---`))throw Error(`formatting would remove frontmatter; file left untouched`);n!==t&&(yield Wn.writeFile(e,n),f++)}catch(e){p++,D((0,P.jsx)(c,{message:`${t}: ${e instanceof Error?e.message:`unknown error`}`}))}}}catch(e){t={error:e}}finally{try{!m&&!e&&(n=h.return)&&(yield n.call(h))}finally{if(t)throw t.error}}D((0,P.jsx)(o,{message:`formatted ${f} of ${d} mdx file${d===1?``:`s`}${p>0?` (${p} failed)`:``}`})),yield N(+(p>0))});var bh=/* @__PURE__ */ n(((e,t)=>{t.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}})),xh=/* @__PURE__ */ n((e=>{let t={INVALID_LOC:`Invalid LOC header (bad signature)`,INVALID_CEN:`Invalid CEN header (bad signature)`,INVALID_END:`Invalid END header (bad signature)`,DESCRIPTOR_NOT_EXIST:`No descriptor present`,DESCRIPTOR_UNKNOWN:`Unknown descriptor format`,DESCRIPTOR_FAULTY:`Descriptor data is malformed`,NO_DATA:`Nothing to decompress`,BAD_CRC:`CRC32 checksum failed {0}`,FILE_IN_THE_WAY:`There is a file in the way: {0}`,UNKNOWN_METHOD:`Invalid/unsupported compression method`,AVAIL_DATA:`inflate::Available inflate data did not terminate`,INVALID_DISTANCE:`inflate::Invalid literal/length or distance code in fixed or dynamic block`,TO_MANY_CODES:`inflate::Dynamic block code description: too many length or distance codes`,INVALID_REPEAT_LEN:`inflate::Dynamic block code description: repeat more than specified lengths`,INVALID_REPEAT_FIRST:`inflate::Dynamic block code description: repeat lengths with no first length`,INCOMPLETE_CODES:`inflate::Dynamic block code description: code lengths codes incomplete`,INVALID_DYN_DISTANCE:`inflate::Dynamic block code description: invalid distance code lengths`,INVALID_CODES_LEN:`inflate::Dynamic block code description: invalid literal/length code lengths`,INVALID_STORE_BLOCK:`inflate::Stored block length did not match one's complement`,INVALID_BLOCK_TYPE:`inflate::Invalid block type (type == 3)`,CANT_EXTRACT_FILE:`Could not extract the file`,CANT_OVERRIDE:`Target file already exists`,DISK_ENTRY_TOO_LARGE:`Number of disk entries is too large`,NO_ZIP:`No zip file was loaded`,NO_ENTRY:`Entry doesn't exist`,DIRECTORY_CONTENT_ERROR:`A directory cannot have content`,FILE_NOT_FOUND:`File not found: "{0}"`,NOT_IMPLEMENTED:`Not implemented`,INVALID_FILENAME:`Invalid filename`,INVALID_FORMAT:`Invalid or unsupported zip format. No END header found`,INVALID_PASS_PARAM:`Incompatible password parameter`,WRONG_PASSWORD:`Wrong Password`,COMMENT_TOO_LONG:`Comment is too long`,EXTRA_FIELD_PARSE_ERROR:`Extra field parsing error`};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||``)),/* @__PURE__ */ Error(`ADM-ZIP: `+e)}}for(let r of Object.keys(t))e[r]=n(t[r])})),Sh=/* @__PURE__ */ n(((t,n)=>{let r=e(`fs`),i=e(`path`),a=bh(),o=xh(),s=typeof process==`object`&&process.platform===`win32`,c=e=>typeof e==`object`&&!!e,l=(/* @__PURE__ */ new Uint32Array(256)).map((e,t)=>{for(let e=0;e<8;e++)t&1?t=3988292384^t>>>1:t>>>=1;return t>>>0});function u(e){this.sep=i.sep,this.fs=r,c(e)&&c(e.fs)&&typeof e.fs.statSync==`function`&&(this.fs=e.fs)}n.exports=u,u.prototype.makeDir=function(e){let t=this;function n(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&e.substr(-1,1)!==`:`){n+=t.sep+e;var r;try{r=t.fs.statSync(n)}catch(e){if(e.message&&e.message.startsWith(`ENOENT`))t.fs.mkdirSync(n);else throw e}if(r&&r.isFile())throw o.FILE_IN_THE_WAY(`"${n}"`)}})}n(e)},u.prototype.writeFileTo=function(e,t,n,r){let a=this;if(a.fs.existsSync(e)&&(!n||a.fs.statSync(e).isDirectory()))return!1;var o=i.dirname(e);a.fs.existsSync(o)||a.makeDir(o);var s;try{s=a.fs.openSync(e,`w`,438)}catch{a.fs.chmodSync(e,438),s=a.fs.openSync(e,`w`,438)}if(s)try{a.fs.writeSync(s,t,0,t.length,0)}finally{a.fs.closeSync(s)}return a.fs.chmodSync(e,r||438),!0},u.prototype.writeFileToAsync=function(e,t,n,r,a){typeof r==`function`&&(a=r,r=void 0);let o=this;o.fs.exists(e,function(s){if(s&&!n)return a(!1);o.fs.stat(e,function(n,c){if(s&&c&&c.isDirectory())return a(!1);var l=i.dirname(e);o.fs.exists(l,function(n){if(!n)try{o.makeDir(l)}catch{return a(!1)}let i=function(n){o.fs.write(n,t,0,t.length,0,function(t){o.fs.close(n,function(){if(t)return a(!1);o.fs.chmod(e,r||438,function(){a(!0)})})})};o.fs.open(e,`w`,438,function(t,n){t?o.fs.chmod(e,438,function(){o.fs.open(e,`w`,438,function(e,t){if(e||!t)return a(!1);i(t)})}):n?i(n):a(!1)})})})})},u.prototype.findFiles=function(e){let t=this;function n(e,r,a,o){typeof r==`boolean`&&(a=r,r=void 0);let s=[];return t.fs.readdirSync(e).forEach(function(c){let l=i.join(e,c),u=t.fs.statSync(l);if((!r||r.test(l))&&s.push(i.normalize(l)+(u.isDirectory()?t.sep:``)),u.isDirectory()&&a){let e=t.fs.realpathSync(l);o.has(e)||(o.add(e),s=s.concat(n(l,r,a,o)))}}),s}return n(e,void 0,!0,/* @__PURE__ */ new Set([t.fs.realpathSync(e)]))},u.prototype.findFilesAsync=function(e,t){let n=this,r=[],a=!1,o=function(e){a||(a=!0,t(e,e?void 0:r))},s=function(e,t,a){n.fs.readdir(e,function(o,c){if(o)return a(o);let l=c.length;if(!l)return a();c.forEach(function(o){let c=i.join(e,o);n.fs.stat(c,function(e,o){if(e)return a(e);o?(r.push(i.normalize(c)+(o.isDirectory()?n.sep:``)),o.isDirectory()?n.fs.realpath(c,function(e,n){if(e)return a(e);t.has(n)?--l||a():(t.add(n),s(c,t,function(e){if(e)return a(e);--l||a()}))}):--l||a()):--l||a()})})})};n.fs.realpath(e,function(t,n){if(t)return o(t);s(e,/* @__PURE__ */ new Set([n]),o)})},u.prototype.getAttributes=function(){},u.prototype.setAttributes=function(){},u.crc32update=function(e,t){return l[(e^t)&255]^e>>>8},u.crc32=function(e){typeof e==`string`&&(e=Buffer.from(e,`utf8`));let t=e.length,n=-1;for(let r=0;r<t;)n=u.crc32update(n,e[r++]);return~n>>>0},u.methodToString=function(e){switch(e){case a.STORED:return`STORED (`+e+`)`;case a.DEFLATED:return`DEFLATED (`+e+`)`;default:return`UNSUPPORTED (`+e+`)`}},u.canonical=function(e){if(!e)return``;let t=i.posix.normalize(`/`+e.split(`\\`).join(`/`));return i.join(`.`,t)},u.zipnamefix=function(e){if(!e)return``;let t=i.posix.normalize(`/`+e.split(`\\`).join(`/`));return i.posix.join(`.`,t)},u.findLast=function(e,t){if(!Array.isArray(e))throw TypeError(`arr is not array`);let n=e.length>>>0;for(let r=n-1;r>=0;r--)if(t(e[r],r,e))return e[r]},u.sanitize=function(e,t){e=i.resolve(i.normalize(e));for(var n=t.split(`/`),r=0,a=n.length;r<a;r++){var o=i.normalize(i.join(e,n.slice(r,a).join(i.sep)));if(o===e||o.startsWith(e+i.sep))return o}return i.normalize(i.join(e,i.basename(t)))},u.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e==`string`?t(e):Buffer.alloc(0)},u.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n},u.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)},u.fromDOS2Date=function(e){return new Date((e>>25&127)+1980,Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(e&31)<<1)},u.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},u.isWin=s,u.crcTable=l})),Ch=/* @__PURE__ */ n(((t,n)=>{let r=e(`path`);n.exports=function(e,{fs:t}){var n=e||``,i=o(),a=null;function o(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return n&&t.existsSync(n)?(a=t.statSync(n),i.directory=a.isDirectory(),i.mtime=a.mtime,i.atime=a.atime,i.executable=!!(73&a.mode),i.readonly=!(128&a.mode),i.hidden=r.basename(n)[0]===`.`):console.warn(`Invalid path: `+n),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:i.directory,isReadOnly:i.readonly,isHidden:i.hidden,isExecutable:i.executable,mTime:i.mtime,aTime:i.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),wh=/* @__PURE__ */ n(((e,t)=>{t.exports={efs:!0,encode:e=>Buffer.from(e,`utf8`),decode:e=>e.toString(`utf8`)}})),Th=/* @__PURE__ */ n(((e,t)=>{t.exports=Sh(),t.exports.Constants=bh(),t.exports.Errors=xh(),t.exports.FileAttr=Ch(),t.exports.decoder=wh()})),Eh=/* @__PURE__ */ n(((e,t)=>{var n=Th(),r=n.Constants;t.exports=function(){var e=20,t=10,i=0,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0;e|=n.isWin?2560:768,i|=r.FLG_EFS;let _={extraLen:0},v=e=>Math.max(0,e)>>>0,y=e=>Math.max(0,e)&255;return o=n.fromDate2DOS(/* @__PURE__ */ new Date),{get made(){return e},set made(t){e=t},get version(){return t},set version(e){t=e},get flags(){return i},set flags(e){i=e},get flags_efs(){return(i&r.FLG_EFS)>0},set flags_efs(e){e?i|=r.FLG_EFS:i&=~r.FLG_EFS},get flags_desc(){return(i&r.FLG_DESC)>0},set flags_desc(e){e?i|=r.FLG_DESC:i&=~r.FLG_DESC},get method(){return a},set method(e){switch(e){case r.STORED:this.version=10;break;case r.DEFLATED:default:this.version=20}a=e},get time(){return n.fromDOS2Date(this.timeval)},set time(e){e=new Date(e),this.timeval=n.fromDate2DOS(e)},get timeval(){return o},set timeval(e){o=v(e)},get timeHighByte(){return y(o>>>8)},get crc(){return s},set crc(e){s=v(e)},get compressedSize(){return c},set compressedSize(e){c=v(e)},get size(){return l},set size(e){l=v(e)},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return d},set extraLength(e){d=e},get extraLocalLength(){return _.extraLen},set extraLocalLength(e){_.extraLen=e},get commentLength(){return f},set commentLength(e){f=e},get diskNumStart(){return p},set diskNumStart(e){p=v(e)},get inAttr(){return m},set inAttr(e){m=v(e)},get attr(){return h},set attr(e){h=v(e)},get fileAttr(){return(h||0)>>16&4095},get offset(){return g},set offset(e){g=v(e)},get encrypted(){return(i&r.FLG_ENC)===r.FLG_ENC},get centralHeaderSize(){return r.CENHDR+u+d+f},get realDataOffset(){return g+r.LOCHDR+_.fnameLen+_.extraLen},get localHeader(){return _},loadLocalHeaderFromBinary:function(e){var t=e.slice(g,g+r.LOCHDR);if(t.readUInt32LE(0)!==r.LOCSIG)throw n.Errors.INVALID_LOC();_.version=t.readUInt16LE(r.LOCVER),_.flags=t.readUInt16LE(r.LOCFLG),_.flags_desc=(_.flags&r.FLG_DESC)>0,_.method=t.readUInt16LE(r.LOCHOW),_.time=t.readUInt32LE(r.LOCTIM),_.crc=t.readUInt32LE(r.LOCCRC),_.compressedSize=t.readUInt32LE(r.LOCSIZ),_.size=t.readUInt32LE(r.LOCLEN),_.fnameLen=t.readUInt16LE(r.LOCNAM),_.extraLen=t.readUInt16LE(r.LOCEXT);let i=g+r.LOCHDR+_.fnameLen,a=i+_.extraLen;return e.slice(i,a)},loadFromBinary:function(_){if(_.length!==r.CENHDR||_.readUInt32LE(0)!==r.CENSIG)throw n.Errors.INVALID_CEN();e=_.readUInt16LE(r.CENVEM),t=_.readUInt16LE(r.CENVER),i=_.readUInt16LE(r.CENFLG),a=_.readUInt16LE(r.CENHOW),o=_.readUInt32LE(r.CENTIM),s=_.readUInt32LE(r.CENCRC),c=_.readUInt32LE(r.CENSIZ),l=_.readUInt32LE(r.CENLEN),u=_.readUInt16LE(r.CENNAM),d=_.readUInt16LE(r.CENEXT),f=_.readUInt16LE(r.CENCOM),p=_.readUInt16LE(r.CENDSK),m=_.readUInt16LE(r.CENATT),h=_.readUInt32LE(r.CENATX),g=_.readUInt32LE(r.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(r.LOCHDR);return e.writeUInt32LE(r.LOCSIG,0),e.writeUInt16LE(t,r.LOCVER),e.writeUInt16LE(i&~r.FLG_DESC,r.LOCFLG),e.writeUInt16LE(a,r.LOCHOW),e.writeUInt32LE(o,r.LOCTIM),e.writeUInt32LE(s,r.LOCCRC),e.writeUInt32LE(c,r.LOCSIZ),e.writeUInt32LE(l,r.LOCLEN),e.writeUInt16LE(u,r.LOCNAM),e.writeUInt16LE(_.extraLen,r.LOCEXT),e},centralHeaderToBinary:function(){var n=Buffer.alloc(r.CENHDR+u+d+f);return n.writeUInt32LE(r.CENSIG,0),n.writeUInt16LE(e,r.CENVEM),n.writeUInt16LE(t,r.CENVER),n.writeUInt16LE(i&~r.FLG_DESC,r.CENFLG),n.writeUInt16LE(a,r.CENHOW),n.writeUInt32LE(o,r.CENTIM),n.writeUInt32LE(s,r.CENCRC),n.writeUInt32LE(c,r.CENSIZ),n.writeUInt32LE(l,r.CENLEN),n.writeUInt16LE(u,r.CENNAM),n.writeUInt16LE(d,r.CENEXT),n.writeUInt16LE(f,r.CENCOM),n.writeUInt16LE(p,r.CENDSK),n.writeUInt16LE(m,r.CENATT),n.writeUInt32LE(h,r.CENATX),n.writeUInt32LE(g,r.CENOFF),n},toJSON:function(){let o=function(e){return e+` bytes`};return{made:e,version:t,flags:i,method:n.methodToString(a),time:this.time,crc:`0x`+s.toString(16).toUpperCase(),compressedSize:o(c),size:o(l),fileNameLength:o(u),extraLength:o(d),commentLength:o(f),diskNumStart:p,inAttr:m,attr:h,offset:g,centralHeaderSize:o(r.CENHDR+u+d+f)}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),Dh=/* @__PURE__ */ n(((e,t)=>{var n=Th(),r=n.Constants;t.exports=function(){var e=0,t=0,i=0,a=0,o=0;let s=()=>e>r.EF_ZIP64_OR_16||t>r.EF_ZIP64_OR_16||i>r.EF_ZIP64_OR_32||a>r.EF_ZIP64_OR_32;return{get diskEntries(){return e},set diskEntries(n){e=t=n},get totalEntries(){return t},set totalEntries(n){t=e=n},get size(){return i},set size(e){i=e},get offset(){return a},set offset(e){a=e},get commentLength(){return o},set commentLength(e){o=e},get mainHeaderSize(){return(s()?r.ZIP64HDR+r.END64HDR:0)+r.ENDHDR+o},loadFromBinary:function(s){if((s.length!==r.ENDHDR||s.readUInt32LE(0)!==r.ENDSIG)&&(s.length<r.ZIP64HDR||s.readUInt32LE(0)!==r.ZIP64SIG))throw n.Errors.INVALID_END();s.readUInt32LE(0)===r.ENDSIG?(e=s.readUInt16LE(r.ENDSUB),t=s.readUInt16LE(r.ENDTOT),i=s.readUInt32LE(r.ENDSIZ),a=s.readUInt32LE(r.ENDOFF),o=s.readUInt16LE(r.ENDCOM)):(e=n.readBigUInt64LE(s,r.ZIP64SUB),t=n.readBigUInt64LE(s,r.ZIP64TOT),i=n.readBigUInt64LE(s,r.ZIP64SIZB),a=n.readBigUInt64LE(s,r.ZIP64OFF),o=0)},toBinary:function(){if(!s()){var c=Buffer.alloc(r.ENDHDR+o);return c.writeUInt32LE(r.ENDSIG,0),c.writeUInt32LE(0,4),c.writeUInt16LE(e,r.ENDSUB),c.writeUInt16LE(t,r.ENDTOT),c.writeUInt32LE(i,r.ENDSIZ),c.writeUInt32LE(a,r.ENDOFF),c.writeUInt16LE(o,r.ENDCOM),c.fill(` `,r.ENDHDR),c}var c=Buffer.alloc(this.mainHeaderSize);let l=0;c.writeUInt32LE(r.ZIP64SIG,l),n.writeBigUInt64LE(c,r.ZIP64HDR-r.ZIP64LEAD,l+r.ZIP64SIZE),c.writeUInt16LE(45,l+r.ZIP64VEM),c.writeUInt16LE(45,l+r.ZIP64VER),c.writeUInt32LE(0,l+r.ZIP64DSK),c.writeUInt32LE(0,l+r.ZIP64DSKDIR),n.writeBigUInt64LE(c,e,l+r.ZIP64SUB),n.writeBigUInt64LE(c,t,l+r.ZIP64TOT),n.writeBigUInt64LE(c,i,l+r.ZIP64SIZB),n.writeBigUInt64LE(c,a,l+r.ZIP64OFF);let u=a+i;return l+=r.ZIP64HDR,c.writeUInt32LE(r.END64SIG,l),c.writeUInt32LE(0,l+r.END64START),n.writeBigUInt64LE(c,u,l+r.END64OFF),c.writeUInt32LE(1,l+r.END64NUMDISKS),l+=r.END64HDR,c.writeUInt32LE(r.ENDSIG,l),c.writeUInt32LE(0,l+4),c.writeUInt16LE(Math.min(e,r.EF_ZIP64_OR_16),l+r.ENDSUB),c.writeUInt16LE(Math.min(t,r.EF_ZIP64_OR_16),l+r.ENDTOT),c.writeUInt32LE(Math.min(i,r.EF_ZIP64_OR_32),l+r.ENDSIZ),c.writeUInt32LE(Math.min(a,r.EF_ZIP64_OR_32),l+r.ENDOFF),c.writeUInt16LE(o,l+r.ENDCOM),c.fill(` `,l+r.ENDHDR),c},toJSON:function(){return{diskEntries:e,totalEntries:t,size:i+` bytes`,offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n=`0`+n;return`0x`+n}(a,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),Oh=/* @__PURE__ */ n((e=>{e.EntryHeader=Eh(),e.MainHeader=Dh()})),kh=/* @__PURE__ */ n(((t,n)=>{n.exports=function(t){var n=e(`zlib`),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return n.deflateRawSync(t,r)},deflateAsync:function(e){var i=n.createDeflateRaw(r),a=[],o=0;i.on(`data`,function(e){a.push(e),o+=e.length}),i.on(`end`,function(){var t=Buffer.alloc(o),n=0;t.fill(0);for(var r=0;r<a.length;r++){var i=a[r];i.copy(t,n),n+=i.length}e&&e(t)}),i.end(t)}}}})),Ah=/* @__PURE__ */ n(((t,n)=>{let r=+(process?.versions?.node??``).split(`.`)[0]||0;n.exports=function(t,n){var i=e(`zlib`);let a=r>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return i.inflateRawSync(t,a)},inflateAsync:function(e){var n=i.createInflateRaw(a),r=[],o=0;n.on(`data`,function(e){r.push(e),o+=e.length}),n.on(`end`,function(){var t=Buffer.alloc(o),n=0;t.fill(0);for(var i=0;i<r.length;i++){var a=r[i];a.copy(t,n),n+=a.length}e&&e(t)}),n.end(t)}}}})),jh=/* @__PURE__ */ n(((t,n)=>{let{randomFillSync:r}=e(`crypto`),i=xh(),a=(/* @__PURE__ */ new Uint32Array(256)).map((e,t)=>{for(let e=0;e<8;e++)t&1?t=t>>>1^3988292384:t>>>=1;return t>>>0}),o=(e,t)=>Math.imul(e,t)>>>0,s=(e,t)=>a[(e^t)&255]^e>>>8,c=()=>typeof r==`function`?r(Buffer.alloc(12)):c.node();c.node=()=>{let e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=Math.random()*256&255;return e};let l={genSalt:c};function u(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}u.prototype.updateKeys=function(e){let t=this.keys;return t[0]=s(t[0],e),t[1]+=t[0]&255,t[1]=o(t[1],134775813)+1,t[2]=s(t[2],t[1]>>>24),e},u.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return o(e,e^1)>>8&255};function d(e){let t=new u(e);return function(e){let n=Buffer.alloc(e.length),r=0;for(let i of e)n[r++]=t.updateKeys(i^t.next());return n}}function f(e){let t=new u(e);return function(e,n,r=0){n||=Buffer.alloc(e.length);for(let i of e){let e=t.next();n[r++]=i^e,t.updateKeys(i)}return n}}function p(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=d(n),a=r(e.slice(0,12)),o=(t.flags&8)==8?t.timeHighByte:t.crc>>>24;if(a[11]!==o)throw i.WRONG_PASSWORD();return r(e.slice(12))}function m(e){Buffer.isBuffer(e)&&e.length>=12?l.genSalt=function(){return e.slice(0,12)}:e===`node`?l.genSalt=c.node:l.genSalt=c}function h(e,t,n,r=!1){e??=Buffer.alloc(0),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=f(n),a=l.genSalt();a[11]=t.crc>>>24&255,r&&(a[10]=t.crc>>>16&255);let o=Buffer.alloc(e.length+12);return i(a,o),i(e,o,12)}n.exports={decrypt:p,encrypt:h,_salter:m}})),Mh=/* @__PURE__ */ n((e=>{e.Deflater=kh(),e.Inflater=Ah(),e.ZipCrypto=jh()})),Nh=/* @__PURE__ */ n(((e,t)=>{var n=Th(),r=Oh(),i=n.Constants,a=Mh();t.exports=function(e,t){var o=new r.EntryHeader,s=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,u=null,d=Buffer.alloc(0),f=Buffer.alloc(0),p=!0;let m=e,h=typeof m.decoder==`object`?m.decoder:n.decoder;p=h.hasOwnProperty(`efs`)?h.efs:!1;function g(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(f=o.loadLocalHeaderFromBinary(t),t.slice(o.realDataOffset,o.realDataOffset+o.compressedSize))}function _(e){let t=o.flags_desc||o.localHeader.flags_desc?o.crc:o.localHeader.crc;return n.crc32(e)===t}function v(e,t,r){if(t===void 0&&typeof e==`string`&&(r=e,e=void 0),l)return e&&t&&t(Buffer.alloc(0),n.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var i=g();if(i.length===0)return e&&t&&t(i),i;if(o.encrypted){if(typeof r!=`string`&&!Buffer.isBuffer(r))throw n.Errors.INVALID_PASS_PARAM();i=a.ZipCrypto.decrypt(i,o,r)}var c;switch(o.method){case n.Constants.STORED:if(c=Buffer.alloc(i.length),i.copy(c),_(c))return e&&t&&t(c),c;throw e&&t&&t(c,n.Errors.BAD_CRC()),n.Errors.BAD_CRC();case n.Constants.DEFLATED:var u=new a.Inflater(i,o.size);if(e)u.inflateAsync(function(e){t&&(_(e)?t(e):t(e,n.Errors.BAD_CRC()))});else{if(c=u.inflate(),!_(c))throw n.Errors.BAD_CRC(`"${h.decode(s)}"`);return c}break;default:throw e&&t&&t(Buffer.alloc(0),n.Errors.UNKNOWN_METHOD()),n.Errors.UNKNOWN_METHOD()}}function y(e,r){if((!u||!u.length)&&Buffer.isBuffer(t))return e&&r&&r(g()),g();if(u.length&&!l){var i;switch(o.method){case n.Constants.STORED:return o.compressedSize=o.size,i=Buffer.alloc(u.length),u.copy(i),e&&r&&r(i),i;default:case n.Constants.DEFLATED:var s=new a.Deflater(u);if(e)s.deflateAsync(function(e){i=Buffer.alloc(e.length),o.compressedSize=e.length,e.copy(i),r&&r(i)});else{var c=s.deflate();return o.compressedSize=c.length,c}s=null}}else if(e&&r)r(Buffer.alloc(0));else return Buffer.alloc(0)}function b(e,t){return n.readBigUInt64LE(e,t)}function x(e){try{for(var t=0,r,a,o;t+4<e.length;)r=e.readUInt16LE(t),t+=2,a=e.readUInt16LE(t),t+=2,o=e.slice(t,t+a),t+=a,i.ID_ZIP64===r&&S(o)}catch{throw n.Errors.EXTRA_FIELD_PARSE_ERROR()}}function S(e){var t,n,r,a;e.length>=i.EF_ZIP64_SCOMP&&(t=b(e,i.EF_ZIP64_SUNCOMP),o.size===i.EF_ZIP64_OR_32&&(o.size=t)),e.length>=i.EF_ZIP64_RHO&&(n=b(e,i.EF_ZIP64_SCOMP),o.compressedSize===i.EF_ZIP64_OR_32&&(o.compressedSize=n)),e.length>=i.EF_ZIP64_DSN&&(r=b(e,i.EF_ZIP64_RHO),o.offset===i.EF_ZIP64_OR_32&&(o.offset=r)),e.length>=i.EF_ZIP64_DSN+4&&(a=e.readUInt32LE(i.EF_ZIP64_DSN),o.diskNumStart===i.EF_ZIP64_OR_16&&(o.diskNumStart=a))}return{get entryName(){return h.decode(s)},get rawEntryName(){return s},set entryName(e){s=n.toBuffer(e,h.encode);var t=s[s.length-1];l=t===47||t===92,o.fileNameLength=s.length},get efs(){return typeof p==`function`?p(this.entryName):p},get extra(){return d},set extra(e){d=e,o.extraLength=e.length,x(e)},get comment(){return h.decode(c)},set comment(e){if(c=n.toBuffer(e,h.encode),o.commentLength=c.length,c.length>65535)throw n.Errors.COMMENT_TOO_LONG()},get name(){let e=h.decode(s);return l?e.replace(/[/\\]$/,``).split(`/`).pop():e.split(`/`).pop()},get isDirectory(){return l},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(e){y(!0,e)},setData:function(e){u=n.toBuffer(e,n.decoder.encode),!l&&u.length?(o.size=u.length,o.method=n.Constants.DEFLATED,o.crc=n.crc32(e),o.changed=!0):o.method=n.Constants.STORED},getData:function(e){return o.changed?u:v(!1,null,e)},getDataAsync:function(e,t){o.changed?e(u):v(!0,e,t)},set attr(e){o.attr=e},get attr(){return o.attr},set header(e){o.loadFromBinary(e)},get header(){return o},packCentralHeader:function(){o.flags_efs=this.efs,o.extraLength=d.length;var e=o.centralHeaderToBinary(),t=n.Constants.CENHDR;return s.copy(e,t),t+=s.length,d.copy(e,t),t+=o.extraLength,c.copy(e,t),e},packLocalHeader:function(){let e=0;o.flags_efs=this.efs,o.extraLocalLength=f.length;let t=o.localHeaderToBinary(),n=Buffer.alloc(t.length+s.length+o.extraLocalLength);return t.copy(n,e),e+=t.length,s.copy(n,e),e+=s.length,f.copy(n,e),e+=f.length,n},toJSON:function(){let e=function(e){return`<`+(e&&e.length+` bytes buffer`||`null`)+`>`};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:o.toJSON(),compressedData:e(t),data:e(u)}},toString:function(){return JSON.stringify(this.toJSON(),null,` `)}}}})),Ph=/* @__PURE__ */ n(((e,t)=>{let n=Nh(),r=Oh(),i=Th();t.exports=function(e,t){var a=[],o=Object.create(null),s=Buffer.alloc(0),c=new r.MainHeader,l=!1;let u=/* @__PURE__ */ new Set,d=t,{noSort:f,decoder:p}=d;e?g(d.readEntries):l=!0;function m(){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(o)){let n=t.split(`/`);if(n.pop(),n.length)for(let t=0;t<n.length;t++){let r=n.slice(0,t+1).join(`/`)+`/`;e.add(r)}}for(let t of e)if(!(t in o)){let e=new n(d);e.entryName=t,e.attr=16,e.temporary=!0,a.push(e),o[e.entryName]=e,u.add(e)}}function h(){if(l=!0,o=Object.create(null),c.diskEntries>(e.length-c.offset)/i.Constants.CENHDR)throw i.Errors.DISK_ENTRY_TOO_LARGE();a=Array(c.diskEntries);for(var t=c.offset,r=0;r<a.length;r++){var s=t,f=new n(d,e);f.header=e.slice(s,s+=i.Constants.CENHDR),f.entryName=e.slice(s,s+=f.header.fileNameLength),f.header.extraLength&&(f.extra=e.slice(s,s+=f.header.extraLength)),f.header.commentLength&&(f.comment=e.slice(s,s+f.header.commentLength)),t+=f.header.centralHeaderSize,a[r]=f,o[f.entryName]=f}u.clear(),m()}function g(t){var n=e.length-i.Constants.ENDHDR,r=Math.max(0,n-65535),a=r,o=e.length,l=-1,u=0;for(typeof d.trailingSpace==`boolean`&&d.trailingSpace&&(r=0);n>=a;n--)if(e[n]===80){if(e.readUInt32LE(n)===i.Constants.ENDSIG)l=n,u=n,o=n+i.Constants.ENDHDR,a=n-i.Constants.END64HDR;else if(e.readUInt32LE(n)===i.Constants.END64SIG)a=r;else if(e.readUInt32LE(n)===i.Constants.ZIP64SIG){l=n,o=n+i.readBigUInt64LE(e,n+i.Constants.ZIP64SIZE)+i.Constants.ZIP64LEAD;break}}if(l==-1)throw i.Errors.INVALID_FORMAT();c.loadFromBinary(e.slice(l,o)),c.commentLength&&(s=e.slice(u+i.Constants.ENDHDR)),t&&h()}function _(){a.length>1&&!f&&(a=a.map(e=>({entry:e,key:e.entryName.toLowerCase()})).sort((e,t)=>e.key.localeCompare(t.key)).map(e=>e.entry))}return{get entries(){return l||h(),a.filter(e=>!u.has(e))},get comment(){return p.decode(s)},set comment(e){s=i.toBuffer(e,p.encode),c.commentLength=s.length},getEntryCount:function(){return l?a.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||h(),o[e]||null},setEntry:function(e){l||h(),a.push(e),o[e.entryName]=e,c.totalEntries=a.length},deleteFile:function(e,t=!0){l||h();let n=o[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||h();let t=o[e],n=a.indexOf(t);n>=0&&(a.splice(n,1),delete o[e],c.totalEntries=a.length)},getEntryChildren:function(e,t=!0){if(l||h(),typeof e==`object`){if(e.isDirectory&&t){let t=[],n=e.entryName;for(let e of a)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){let t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||h(),_();let t=[],n=[],r=0,i=0;c.size=0,c.offset=0;let a=0;for(let e of this.entries){let o=e.getCompressedData();e.header.offset=i;let s=e.packLocalHeader(),l=s.length+o.length;i+=l,t.push(s),t.push(o);let u=e.packCentralHeader();n.push(u),c.size+=u.length,r+=l+u.length,a++}r+=c.mainHeaderSize,c.offset=i,c.totalEntries=a,i=0;let o=Buffer.alloc(r);for(let e of t)e.copy(o,i),i+=e.length;for(let e of n)e.copy(o,i),i+=e.length;let u=c.toBinary();return s&&s.copy(u,u.length-s.length),u.copy(o,i),e=o,l=!1,o},toAsyncBuffer:function(t,n,r,i){try{l||h(),_();let n=[],a=[],o=0,u=0,d=0;c.size=0,c.offset=0;let f=function(p){if(p.length>0){let e=p.shift(),t=e.entryName+e.extra.toString();r&&r(t),e.getCompressedDataAsync(function(r){i&&i(t),e.header.offset=u;let s=e.packLocalHeader(),l=s.length+r.length;u+=l,n.push(s),n.push(r);let m=e.packCentralHeader();a.push(m),c.size+=m.length,o+=l+m.length,d++,f(p)})}else{o+=c.mainHeaderSize,c.offset=u,c.totalEntries=d,u=0;let r=Buffer.alloc(o);n.forEach(function(e){e.copy(r,u),u+=e.length}),a.forEach(function(e){e.copy(r,u),u+=e.length});let i=c.toBinary();s&&s.copy(i,i.length-s.length),i.copy(r,u),e=r,l=!1,t(r)}};f(Array.from(this.entries))}catch(e){n(e)}}}}})),Fh=/* @__PURE__ */ t((/* @__PURE__ */ n(((t,n)=>{let r=Th(),i=e(`path`),a=Nh(),o=Ph(),s=(...e)=>r.findLast(e,e=>typeof e==`boolean`),c=(...e)=>r.findLast(e,e=>typeof e==`string`),l=(...e)=>r.findLast(e,e=>typeof e==`function`),u={noSort:!1,readEntries:!1,method:r.Constants.NONE,fs:null};n.exports=function(e,t){let n=null,d=Object.assign(Object.create(null),u);e&&typeof e==`object`&&(e instanceof Uint8Array||(Object.assign(d,e),e=d.input?d.input:void 0,d.input&&delete d.input),Buffer.isBuffer(e)&&(n=e,d.method=r.Constants.BUFFER,e=void 0)),Object.assign(d,t);let f=new r(d),p=e=>{e.filter(e=>e.attr).sort((e,t)=>t.path.length-e.path.length).forEach(e=>f.fs.chmodSync(e.path,e.attr))};if((typeof d.decoder!=`object`||typeof d.decoder.encode!=`function`||typeof d.decoder.decode!=`function`)&&(d.decoder=r.decoder),e&&typeof e==`string`){if(f.fs.existsSync(e))d.method=r.Constants.FILE,d.filename=e,n=f.fs.readFileSync(e);else throw r.Errors.INVALID_FILENAME()}let m=new o(n,d),{canonical:h,sanitize:g,zipnamefix:_}=r;function v(e){if(e&&m){var t;if(typeof e==`string`&&(t=m.getEntry(i.posix.normalize(e))),typeof e==`object`&&e.entryName!==void 0&&e.header!==void 0&&(t=m.getEntry(e.entryName)),t)return t}return null}function y(e){let{join:t,normalize:n,sep:r}=i.posix;return t(i.isAbsolute(e)?`/`:`.`,n(r+e.split(`\\`).join(r)+r))}function b(e){return e instanceof RegExp?(function(e){return function(t){return e.test(t)}})(e):typeof e==`function`?e:()=>!0}let x=(e,t)=>{let n=t.slice(-1);return n=n===f.sep?f.sep:``,i.relative(e,t)+n};return{readFile:function(e,t){var n=v(e);return n&&n.getData(t)||null},childCount:function(e){let t=v(e);if(t)return m.getChildCount(t)},readFileAsync:function(e,t){var n=v(e);n?n.getDataAsync(t):t(null,`getEntry failed for:`+e)},readAsText:function(e,t){var n=v(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||`utf8`)}return``},readAsTextAsync:function(e,t,n){var r=v(e);r?r.getDataAsync(function(e,r){r?t(e,r):e&&e.length?t(e.toString(n||`utf8`)):t(``)}):t(``)},deleteFile:function(e,t=!0){var n=v(e);n&&m.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=v(e);t&&m.deleteEntry(t.entryName)},addZipComment:function(e){m.comment=e},getZipComment:function(){return m.comment||``},addZipEntryComment:function(e,t){var n=v(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=v(e);return t&&t.comment||``},updateFile:function(e,t){var n=v(e);n&&n.setData(t)},addLocalFile:function(e,t,n,a){if(f.fs.existsSync(e)){t=t?y(t):``;let r=i.win32.basename(i.win32.normalize(e));t+=n||r;let o=f.fs.statSync(e),s=o.isFile()?f.fs.readFileSync(e):Buffer.alloc(0);o.isDirectory()&&(t+=f.sep),this.addFile(t,s,a,o)}else throw r.Errors.FILE_NOT_FOUND(e)},addLocalFileAsync:function(e,t){e=typeof e==`object`?e:{localPath:e};let n=i.resolve(e.localPath),{comment:r}=e,{zipPath:a,zipName:o}=e,s=this;f.fs.stat(n,function(e,c){if(e)return t(e,!1);a=a?y(a):``;let l=i.win32.basename(i.win32.normalize(n));if(a+=o||l,c.isFile())f.fs.readFile(n,function(e,n){return e?t(e,!1):(s.addFile(a,n,r,c),setImmediate(t,void 0,!0))});else if(c.isDirectory())return a+=f.sep,s.addFile(a,Buffer.alloc(0),r,c),setImmediate(t,void 0,!0)})},addLocalFolder:function(e,t,n){if(n=b(n),t=t?y(t):``,e=i.normalize(e),f.fs.existsSync(e)){let r=f.findFiles(e),a=this;if(r.length)for(let o of r){let r=i.join(t,x(e,o));n(r)&&a.addLocalFile(o,i.dirname(r))}}else throw r.Errors.FILE_NOT_FOUND(e)},addLocalFolderAsync:function(e,t,n,a){a=b(a),n=n?y(n):``,e=i.normalize(e);var o=this;f.fs.open(e,`r`,function(i){if(i&&i.code===`ENOENT`)t(void 0,r.Errors.FILE_NOT_FOUND(e));else if(i)t(void 0,i);else{var s=f.findFiles(e),c=-1,l=function(){if(c+=1,c<s.length){var r=s[c],i=x(e,r).split(`\\`).join(`/`);i=i.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\x20-\x7E]/g,``),a(i)?f.fs.stat(r,function(e,a){e&&t(void 0,e),a.isFile()?f.fs.readFile(r,function(e,r){e?t(void 0,e):(o.addFile(n+i,r,``,a),l())}):(o.addFile(n+i+`/`,Buffer.alloc(0),``,a),l())}):process.nextTick(()=>{l()})}else t(!0,void 0)};l()}})},addLocalFolderAsync2:function(e,t){let n=this;e=typeof e==`object`?e:{localPath:e};let a=i.resolve(y(e.localPath)),{zipPath:o,filter:s,namefix:c}=e;s instanceof RegExp?s=(function(e){return function(t){return e.test(t)}})(s):typeof s!=`function`&&(s=function(){return!0}),o=o?y(o):``,c===`latin1`&&(c=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\x20-\x7E]/g,``)),typeof c!=`function`&&(c=e=>e);let l=e=>i.join(o,c(x(a,e))),u=e=>i.win32.basename(i.win32.normalize(c(e)));f.fs.open(a,`r`,function(e){e&&e.code===`ENOENT`?t(void 0,r.Errors.FILE_NOT_FOUND(a)):e?t(void 0,e):f.findFilesAsync(a,function(e,r){if(e)return t(e);r=r.filter(e=>s(l(e))),r.length||t(void 0,!1),setImmediate(r.reverse().reduce(function(e,t){return function(r,a){if(r||a===!1)return setImmediate(e,r,!1);n.addLocalFileAsync({localPath:t,zipPath:i.dirname(l(t)),zipName:u(t)},e)}},t))})})},addLocalFolderPromise:function(e,t){return new Promise((n,r)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&r(e),t&&n(this)})})},addFile:function(e,t,n,r){e=_(e);let i=v(e),o=i!=null;o||(i=new a(d),i.entryName=e),i.comment=n||``;let s=typeof r==`object`&&r instanceof f.fs.Stats;s&&(i.header.time=r.mtime);var c=i.isDirectory?16:0;let l=i.isDirectory?16384:32768;return l|=s?4095&r.mode:typeof r==`number`?4095&r:i.isDirectory?493:420,c=(c|l<<16)>>>0,i.attr=c,i.setData(t),o||m.setEntry(i),i},getEntries:function(e){return m.password=e,m?m.entries:[]},getEntry:function(e){return v(e)},getEntryCount:function(){return m.getEntryCount()},forEach:function(e){return m.forEach(e)},extractEntryTo:function(e,t,n,a,o,l){a=s(!1,a),o=s(!1,o),n=s(!0,n),l=c(o,l);var u=v(e);if(!u)throw r.Errors.NO_ENTRY();var d=h(u.entryName),p=g(t,l&&!u.isDirectory?h(l):n?d:i.basename(d));if(u.isDirectory)return m.getEntryChildren(u).forEach(function(e){if(e.isDirectory)return;var i=e.getData();if(!i)throw r.Errors.CANT_EXTRACT_FILE();var s=h(n?e.entryName:e.entryName.substring(u.entryName.length)),c=g(t,s);let l=o?e.header.fileAttr:void 0;f.writeFileTo(c,i,a,l)}),!0;var _=u.getData(m.password);if(!_)throw r.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(p)&&!a)throw r.Errors.CANT_OVERRIDE();let y=o?e.header.fileAttr:void 0;return f.writeFileTo(p,_,a,y),!0},test:function(e){if(!m)return!1;for(var t of m.entries)try{if(t.isDirectory)continue;if(!t.getData(e))return!1}catch{return!1}return!0},extractAllTo:function(e,t,n,i){if(n=s(!1,n),i=c(n,i),t=s(!1,t),!m)throw r.Errors.NO_ZIP();let a=[];m.entries.forEach(function(o){var s=g(e,h(o.entryName));if(o.isDirectory){f.makeDir(s),n&&a.push({path:s,attr:o.header.fileAttr});return}var c=o.getData(i);if(!c)throw r.Errors.CANT_EXTRACT_FILE();let l=n?o.header.fileAttr:void 0;f.writeFileTo(s,c,t,l);try{f.fs.utimesSync(s,o.header.time,o.header.time)}catch{}}),p(a)},extractAllToAsync:function(e,t,n,a){if(a=l(t,n,a),n=s(!1,n),t=s(!1,t),!a)return new Promise((r,i)=>{this.extractAllToAsync(e,t,n,function(e){e?i(e):r(this)})});if(!m){a(r.Errors.NO_ZIP());return}e=i.resolve(e);let o=t=>g(e,i.normalize(h(t.entryName))),c=(e,t)=>/* @__PURE__ */ Error(e+`: "`+t+`"`),u=[],d=[];m.entries.forEach(e=>{e.isDirectory?u.push(e):d.push(e)});let _=[];for(let e of u){let t=o(e),r=n?e.header.fileAttr:void 0;try{f.makeDir(t)}catch{a(c(`Unable to create folder`,t));continue}r&&_.push({path:t,attr:r});try{f.fs.utimesSync(t,e.header.time,e.header.time)}catch{}}d.reverse().reduce(function(a,o){return function(s){if(s)a(s);else{let s=i.normalize(h(o.entryName)),l=g(e,s);o.getDataAsync(function(e,i){if(i)a(i);else if(!e)a(r.Errors.CANT_EXTRACT_FILE());else{let r=n?o.header.fileAttr:void 0;f.writeFileToAsync(l,e,t,r,function(e){if(!e)return a(c(`Unable to write file`,l));f.fs.utimes(l,o.header.time,o.header.time,function(){a()})})}})}}},e=>{if(!e)try{p(_)}catch(e){return a(c(`Unable to set folder permissions`,e.path||``))}a(e)})()},writeZip:function(e,t){if(arguments.length===1&&typeof e==`function`&&(t=e,e=``),!e&&d.filename&&(e=d.filename),e){var n=m.compressToBuffer();if(n){var r=f.writeFileTo(e,n,!0);typeof t==`function`&&t(r?null:/* @__PURE__ */ Error(`failed`),``)}}},writeZipPromise:function(e,t){let{overwrite:n,perm:r}=Object.assign({overwrite:!0},t);return new Promise((t,i)=>{!e&&d.filename&&(e=d.filename),e||i(`ADM-ZIP: ZIP File Name Missing`),this.toBufferPromise().then(a=>{f.writeFileToAsync(e,a,n,r,e=>e?t(e):i(`ADM-ZIP: Wasn't able to write zip file`))},i)})},toBufferPromise:function(){return new Promise((e,t)=>{m.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,r){return typeof e==`function`?(m.toAsyncBuffer(e,t,n,r),null):m.compressToBuffer()}}}})))(),1),Ih=/* @__PURE__ */ t(St(),1),Lh=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const Rh=`mintlify`,zh=`templates`,Bh=`main`;function Vh(){return Lh(this,void 0,void 0,function*(){let e=yield fetch(`https://api.github.com/repos/${Rh}/${zh}/contents/?ref=${Bh}`,{headers:{Accept:`application/vnd.github.v3+json`}});if(!e.ok)throw Error(`Failed to fetch templates: ${e.status} ${e.statusText}`);return(yield e.json()).filter(e=>e.type===`dir`).map(e=>e.name)})}function Hh(e){return Lh(this,void 0,void 0,function*(){if(!e||e===`.`||e===`..`||e.includes(`/`))throw Error(`Invalid template name: "${e}".`);let t=`https://api.github.com/repos/${Rh}/${zh}/contents/${encodeURIComponent(e)}?ref=${Bh}`,n=yield fetch(t,{headers:{Accept:`application/vnd.github.v3+json`}});if(!n.ok){let t=yield Vh().catch(()=>[]),n=t.length>0?` Available templates: ${t.join(`, `)}`:``;throw Error(`Template "${e}" not found in ${Rh}/${zh}.${n}`)}if(!(yield n.json()).some(e=>e.name===`docs.json`))throw Error(`Template "${e}" is not a valid Mintlify template (missing docs.json).`);return e})}function Uh(){return Lh(this,void 0,void 0,function*(){D((0,P.jsx)(f,{message:`fetching available templates...`}));let e;try{e=yield Vh()}catch{throw a(),Error(`Failed to fetch templates. Please check your network connection and try again.`)}if(a(),e.length===0)throw Error(`No templates are currently available.`);return Zd({message:`Choose a template`,choices:e.map(e=>({name:e,value:e}))})})}function Wh(e,t,n,r){return Lh(this,void 0,void 0,function*(){let i=jn.join(e,`__template__.zip`),o=jn.join(e,`__template_extract__`);try{D((0,P.jsx)(f,{message:`downloading template "${t}"...`}));try{let e=yield fetch(`https://github.com/${Rh}/${zh}/archive/refs/heads/${Bh}.zip`);if(!e.ok)throw Error(`Failed to download templates archive: ${e.status}`);let t=yield e.arrayBuffer();yield Ih.default.writeFile(i,Buffer.from(t))}finally{a()}D((0,P.jsx)(f,{message:`extracting template...`}));try{new Fh.default(i).extractAllTo(o,!0)}finally{a()}let n=jn.join(o,`${zh}-${Bh}`),r=jn.join(n,t);if(!(yield Ih.default.pathExists(r)))throw Error(`Template directory "${t}" not found in the downloaded archive.`);yield Ih.default.copy(r,e,{overwrite:!0})}finally{yield Ih.default.remove(i).catch(()=>{}),yield Ih.default.remove(o).catch(()=>{})}let s=jn.join(e,`docs.json`);if(yield Ih.default.pathExists(s)){let e=yield Ih.default.readJson(s);n&&(e.name=n),r&&(e.theme=r),yield Ih.default.writeJson(s,e,{spaces:2})}})}var Gh=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const Kh=e=>{h((0,P.jsx)(M,{bold:!0,children:`Documentation Setup!`}),(0,P.jsx)(M,{children:`To see your docs run`}),(0,P.jsxs)(ke,{children:[(0,P.jsx)(M,{color:`blue`,children:`cd`}),(0,P.jsxs)(M,{children:[` `,e]})]}),(0,P.jsx)(M,{color:`blue`,children:`mint dev`})),Je()&&D((0,P.jsxs)(M,{children:["When the docs are ready, run `mint validate` in ",e,` to check the build and get publish steps.`]}))},qh=(e,t,n,r)=>{let i=r===void 0?`Unable to fetch templates — use --template flag if you know the name`:r.length>0?`Templates: ${JSON.stringify(r)}`:`No templates are currently available`;h((0,P.jsx)(M,{children:`Agent Detected - sending AI friendly prompt`}),(0,P.jsx)(M,{children:`<system-message>`}),(0,P.jsx)(M,{children:"Help the user set up a Mintlify docs site with `mint new`. Ask each step one at a time unless the user asks you to skip questions or use your best judgment."}),(0,P.jsx)(M,{children:[`- [ ] Pick a theme or clone a template? (${i})`,`- [ ] If template: which one? If theme: which one? (Themes: ${JSON.stringify(n)})`,`- [ ] Project name?`,`- [ ] Directory? (default: "${e}", auto-created if needed)${t?` ⚠️ "${e}" is occupied — subdirectory, overwrite (--force), or different path?`:``}`].join(`
556
556
  `)}),(0,P.jsx)(M,{children:"Command: `mint new [dir] --theme [theme] --name [name]` or `mint new [dir] --template [template] --name [name]`. --theme optionally overrides a template default. --force overwrites non-empty dirs. Use AskQuestion to present choices."}),(0,P.jsx)(M,{children:`</system-message>`}))};function Jh(e,t,n){return Gh(this,void 0,void 0,function*(){let r=yield Vh().catch(()=>void 0);qh(e,t,n,r)})}function Yh(e,t,n){return Gh(this,void 0,void 0,function*(){if(!n)return e;if(Je())return t?e:void 0;let r=yield Zd({message:`Directory ${e} is not empty. What would you like to do?`,choices:[{name:`Create in a subdirectory`,value:`subdir`},{name:`Overwrite current directory (may lose contents)`,value:`overwrite`},{name:`Cancel`,value:`cancel`}]});if(r!==`cancel`){if(r===`subdir`){let t=yield It({message:`Subdirectory name:`,default:`docs`});if(!t||t.trim()===``)throw Error(`Subdirectory name cannot be empty`);let n=e===`.`?t:`${e}/${t}`;return pe(n,process.cwd()),n}return e}})}function Xh(e,t){return Gh(this,void 0,void 0,function*(){return t||It({message:`Project Name`,default:e===`.`?`Mintlify`:e})})}function Zh(){return Gh(this,void 0,void 0,function*(){if((yield Zd({message:`How would you like to set up your docs?`,choices:[{name:`Pick a theme`,value:`theme`},{name:`Clone a template`,value:`template`}]}))===`template`)return Uh()})}function Qh(e,t,n,r,i){return Gh(this,void 0,void 0,function*(){pe(e);let a=he.options.map(e=>e.shape.theme._def.value),o=(yield Ih.default.readdir(e).catch(()=>[])).length>0;if(Je()&&(!r||!i&&!n)||Je()&&o&&!t){yield Jh(e,o,a);return}let s=i?yield Hh(i).then(()=>i):!Je()&&!n?yield Zh():void 0;if(s){let i=yield Yh(e,t,o);if(i===void 0){Je()&&(yield Jh(e,o,a));return}let c=yield Xh(i,r);yield Ih.default.ensureDir(i),yield Wh(i,s,c,n),Kh(i);return}let c=yield Yh(e,t,o);if(c===void 0){Je()&&(yield Jh(e,o,a));return}let l=r,u=n;Je()||u&&l||(l=yield Xh(c,l),u||=yield Zd({message:`Theme`,choices:a.map(e=>({name:e,value:e}))})),l===void 0||u===void 0?yield Jh(c,o,a):(yield Ih.default.ensureDir(c),yield $h(c,l,u),Kh(c))})}const $h=(e,t,n)=>Gh(void 0,void 0,void 0,function*(){D((0,P.jsx)(f,{message:`downloading starter template...`}));let r=yield(yield fetch(`https://github.com/mintlify/starter/archive/refs/heads/main.zip`)).arrayBuffer();yield Ih.default.writeFile(e+`/starter.zip`,Buffer.from(r)),a(),D((0,P.jsx)(f,{message:`extracting...`})),new Fh.default(e+`/starter.zip`).extractAllTo(e,!0),a(),yield Ih.default.copy(e+`/starter-main`,e,{overwrite:!0,filter:e=>!e.includes(`starter-main/starter-main`)}),yield Ih.default.remove(e+`/starter.zip`),yield Ih.default.remove(e+`/starter-main`);let i=e+`/docs.json`,o=yield Ih.default.readJson(i);o.theme=n,o.name=t,yield Ih.default.writeJson(i,o,{spaces:2})});var eg=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const tg=[{name:`overview`,when:`Start here: how Mintlify works and facts agents most often get wrong`},{name:`new-site`,when:`New docs site, first publish, no account, claim a site, login, no docs.json yet`},{name:`write`,when:`Before creating a page or writing more than a sentence or two; changelogs`},{name:`write components`,when:`Adding or changing components: callouts, cards, steps, tabs, accordions, fields`},{name:`configure`,when:`Changing docs.json: theme, colors, logo, favicon, required fields`},{name:`configure navigation`,when:`Changing navigation: groups, tabs, anchors, dropdowns, products, versions, languages`},{name:`configure settings`,when:`navbar, footer, banner, SEO, search, integrations, contextual menu, redirects, 404`},{name:`configure customization`,when:`Themes, fonts, CSS, JavaScript, or React snippets`},{name:`api-docs`,when:`API documentation: OpenAPI, AsyncAPI, GraphQL, playground`},{name:`api-docs sdk`,when:`SDK reference pages, x-codeSamples, oneOf/anyOf, multiple responses, hiding endpoints`},{name:`publish`,when:`Deploying, "is it live", previews, rollbacks, MCP, llms.txt, skill.md, Markdown export`},{name:`publish domain`,when:`Custom domain (mint add-domain), /docs subpath, reverse proxy, CSP`},{name:`publish repo`,when:`Monorepo, multi-repo, GitHub/GitLab/Bitbucket, offline export, self-host`},{name:`publish analytics`,when:`mint analytics, feedback, search data, analytics integrations`},{name:`publish assistant`,when:`AI assistant, widget, Assistant.md, skills, narration, own model`},{name:`access`,when:`Private docs, reader login, user groups, personalization`},{name:`access team`,when:`Team members, roles, SSO, SCIM, audit logs, session security`},{name:`automate`,when:`Keep docs in sync with code: agent, Autopilot, automations, Slack, CI`},{name:`migrate`,when:`Moving docs from Docusaurus, GitBook, ReadMe, Fern, Document360, Confluence, Markdown`},{name:`troubleshoot`,when:`An error, a failed build or deploy, or the site looks wrong`}],ng=()=>{let e=Math.max(...tg.map(({name:e})=>e.length))+2;return[`Usage: mint instructions <topic> [subtopic]`,``,...tg.map(({name:t,when:n})=>` ${t.padEnd(e)}${n}`),``].join(`
557
557
  `)},rg=e=>`https://www.mintlify.com/docs/mint-instructions/${e.map(encodeURIComponent).join(`/`)}.md`,ig=e=>e.replace(/^(?:>.*\n|\s*\n)*/,``);function ag(e){return eg(this,void 0,void 0,function*(){let t=rg(e),n=yield fetch(t);if(n.status===404)throw Error(`no instructions for "${e.join(` `)}". Run \`mint instructions\` to list topics.`);if(!n.ok)throw Error(`failed to fetch ${t}: ${n.status} ${n.statusText}`);return ig(yield n.text())})}var og=/* @__PURE__ */ t(m(),1);typeof navigator>`u`||navigator.userAgent?.startsWith?.(`Mozilla/5.0 `);const sg=`ERR_INVALID_ARG_VALUE`;function cg(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const lg=Symbol(),ug=Symbol(),dg=Symbol(),fg=new TextEncoder,pg=new TextDecoder;function mg(e){return typeof e==`string`?fg.encode(e):pg.decode(e)}let hg;if(Uint8Array.prototype.toBase64)hg=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:`base64url`,omitPadding:!0}));else{let e=32768;hg=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));let n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join(``)).replace(/=/g,``).replace(/\+/g,`-`).replace(/\//g,`_`)}}let gg;gg=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:`base64url`})}catch(e){throw cg(`The input to be decoded is not correctly encoded.`,sg,e)}}:e=>{try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`).replace(/\s/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw cg(`The input to be decoded is not correctly encoded.`,sg,e)}};function _g(e){return typeof e==`string`?gg(e):hg(e)}var vg=class extends Error{code;constructor(e,t){super(e,t),this.name=this.constructor.name,t?.code&&(this.code=t?.code),Error.captureStackTrace?.(this,this.constructor)}};function yg(e,t,n){return new vg(e,{code:t,cause:n})}function bg(e,t,n,r){try{if(typeof e!=`string`)throw cg(`${t} must be a string`,`ERR_INVALID_ARG_TYPE`,r);if(e.length===0)throw cg(`${t} must not be empty`,sg,r)}catch(e){throw n?yg(e.message,n,r):e}}function xg(){return _g(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)))}function Sg(){return xg()}function Cg(){return xg()}function wg(){return xg()}async function Tg(e){return bg(e,`codeVerifier`),_g(await crypto.subtle.digest(`SHA-256`,mg(e)))}function Eg(e){return bg(e,`"clientSecret"`),(t,n,r,i)=>{r.set(`client_id`,n.client_id),r.set(`client_secret`,e)}}function Dg(){return(e,t,n,r)=>{n.set(`client_id`,t.client_id)}}URL.parse;const Og=Symbol();typeof navigator<`u`&&navigator.userAgent?.startsWith?.(`Mozilla/5.0 `);const kg=e=>Ag.get(e);let Ag,jg;function Mg(e){return e===void 0?(jg||=/* @__PURE__ */ new WeakMap,(e,t,n,r)=>{let i;return(i=jg.get(t))||(Ng(t.client_secret,`"metadata.client_secret"`),i=Eg(t.client_secret),jg.set(t,i)),i(e,t,n,r)}):Eg(e)}function Ng(e,t){if(typeof e!=`string`)throw Rg(`${t} must be a string`,Lg);if(e.length===0)throw Rg(`${t} must not be empty`,Ig)}function Pg(){return Dg()}const Fg=dg,Ig=`ERR_INVALID_ARG_VALUE`,Lg=`ERR_INVALID_ARG_TYPE`;function Rg(e,t,n){let r=TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}function zg(e){return Tg(e)}function Bg(){return Sg()}function Vg(){return wg()}function Hg(){return Cg()}new TextDecoder;function Ug(e){return{supportsPKCE:{__proto__:null,value(t=`S256`){return e.code_challenge_methods_supported?.includes(t)===!0}}}}function Wg(e){Object.defineProperties(e,Ug(e))}const Gg=Symbol();Object.freeze(class{constructor(e,t,n,r){if(typeof t!=`string`||!t.length)throw Rg(`"clientId" must be a non-empty string`,Lg);if(typeof n==`string`&&(n={client_secret:n}),n?.client_id!==void 0&&t!==n.client_id)throw Rg(`"clientId" and "metadata.client_id" must be the same`,Ig);let i={...structuredClone(n),client_id:t};i[lg]=n?.[lg]??0,i[ug]=n?.[ug]??30;let a;a=r||(typeof i.client_secret==`string`&&i.client_secret.length?Mg(i.client_secret):Pg());let o=Object.freeze(i),s=structuredClone(e);Gg in e&&(s[Og]=({claims:{tid:t}})=>e.issuer.replace(`{tenantid}`,t));let c=Object.freeze(s);Ag||=/* @__PURE__ */ new WeakMap,Ag.set(this,{__proto__:null,as:c,c:o,auth:a,tlsOnly:!0,jwksCache:{}})}serverMetadata(){let e=structuredClone(kg(this).as);return Wg(e),e}clientMetadata(){return structuredClone(kg(this).c)}get timeout(){return kg(this).timeout}set timeout(e){kg(this).timeout=e}get[Fg](){return kg(this).fetch}set[Fg](e){kg(this).fetch=e}}.prototype);var Kg=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function qg(){return Kg(this,void 0,void 0,function*(){let{default:e}=yield import(`http`),t,n,r=!1,i=new Promise((e,r)=>{t=e,n=r}),a=e.createServer((e,n)=>{if(n.setHeader(`Access-Control-Allow-Origin`,it),n.setHeader(`Access-Control-Allow-Methods`,`POST, OPTIONS`),n.setHeader(`Access-Control-Allow-Headers`,`Content-Type`),e.method===`OPTIONS`)n.writeHead(204),n.end();else if(e.method===`POST`){let i=``;e.on(`data`,e=>{i+=e}),e.on(`end`,()=>{try{let{code:e}=JSON.parse(i);n.writeHead(200,{"Content-Type":`application/json`}),n.end(JSON.stringify({ok:!0})),r=!0,a.close(),t(e)}catch{n.writeHead(400),n.end(JSON.stringify({error:`invalid body`}))}})}else n.writeHead(405),n.end()});return a.listen(pt,`localhost`),{codePromise:i,close:()=>{r||(r=!0,a.close(),n(/* @__PURE__ */ Error(`Login cancelled`)))}}})}var Jg=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function Yg(){return Jg(this,arguments,void 0,function*({signup:e=!1}={}){let t=Bg(),n=yield zg(t),r=Vg(),i=Hg(),a=Buffer.from(JSON.stringify({nonce:r,clientState:i})).toString(`base64url`),s=new URL(`/api/cli/oauth/authorize`,it);s.searchParams.set(`state`,a),s.searchParams.set(`code_challenge`,n),e&&s.searchParams.set(`flow`,`cli-signup`);let l=new URL(`/signup`,it);l.searchParams.set(`next`,`${s.pathname}${s.search}`);let u=(e?l:s).toString();hd();let{codePromise:d,close:f}=yield qg();D((0,P.jsxs)(ke,{flexDirection:`column`,gap:1,paddingY:1,children:[(0,P.jsxs)(M,{bold:!0,children:[(0,P.jsx)(M,{color:`green`,children:`◆ `}),`A browser window will open to`,` `,e?`create your Mintlify account`:`authenticate with Mintlify`]}),(0,P.jsxs)(ke,{flexDirection:`column`,paddingLeft:3,gap:1,children:[(0,P.jsx)(M,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL:`}),(0,P.jsx)(M,{dimColor:!0,children:u})]})]})),(0,og.default)(u).catch(()=>{}),D((0,P.jsxs)(ke,{flexDirection:`column`,paddingLeft:1,marginTop:1,children:[(0,P.jsx)(M,{dimColor:!0,children:`╭─ Paste the authorization code from your browser`}),(0,P.jsx)(M,{dimColor:!0,children:`│`})]})),yield new Promise(e=>setTimeout(e,50));let p=It({message:`█`,theme:{prefix:w.dim(` │`),style:{answer:e=>w.cyan(e)}}}),m;try{m=yield Promise.race([d,p])}catch{f(),p.cancel(),D((0,P.jsx)(c,{message:`login cancelled`}));return}f(),p.cancel();let h=yield fetch(xt,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({grant_type:`authorization_code`,code:m,code_verifier:t})}),g=yield h.json().catch(()=>({}));if(!h.ok){let e=g.error_message??g.error??`unknown error`;_d(e),D((0,P.jsx)(c,{message:`login failed: ${e}`}));return}let _=g;yield Xl(_.access_token,_.refresh_token,nu(_.id_token)??null),e&&(yield gt(`subdomain`).catch(()=>void 0)),gd(),D((0,P.jsx)(o,{message:e?`account created and logged in successfully`:`logged in successfully`})),yield Zg(_.access_token)})}function Xg(e){return e instanceof Error&&e.name===`ExitPromptError`}function Zg(e){return Jg(this,void 0,void 0,function*(){let t=yield mu(e);if(t.length===0)return;if(t.length===1){yield lt(`subdomain`,t[0]),D((0,P.jsx)(u,{message:`default project set to ${t[0]}`}));return}yield new Promise(e=>setTimeout(e,50));let n;try{n=yield Vt({message:`Select a default project`,source:e=>(e?t.filter(t=>t.toLowerCase().includes(e.toLowerCase())):t).map(e=>({name:e,value:e}))})}catch(e){if(Xg(e)){D((0,P.jsx)(u,{message:`No project set. To set a default project, run ${w.bold(`mintlify config set subdomain <subdomain>`)}`}));return}throw e}yield lt(`subdomain`,n),D((0,P.jsx)(u,{message:`default project set to ${n}`}))})}var Qg=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function $g(){return Qg(this,void 0,void 0,function*(){yield tu(),D((0,P.jsx)(o,{message:`logged out successfully`}))})}var e_=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const t_=(e,t)=>{let n=[],r=()=>t=>(mn(t,t=>{if(t.type===`image`){t.alt&&t.alt.trim()!==``||n.push({filePath:e,line:t.position?.start.line,column:t.position?.start.column,element:`img`,tagName:`image (markdown)`});return}let r=t;if(r.name===`img`||r.name===`video`){let i=r.attributes.findIndex(e=>e.type===`mdxJsxAttribute`&&e.name===`alt`),a=r.attributes[i];a&&typeof a.value==`string`&&a.value.trim()!==``||n.push({filePath:e,line:t.position?.start.line,column:t.position?.start.column,element:r.name,tagName:r.name})}else if(r.name===`a`){let i=e=>e.some(e=>e.type===`text`?e.value.trim()!==``:`children`in e&&Array.isArray(e.children)?i(e.children):!1);i(r.children)||n.push({filePath:e,line:t.position?.start.line,column:t.position?.start.column,element:`a`,tagName:`<a>`})}}),t);try{let e=t.replace(/^( {0,3}#{1,6}\s+.+?)\s*\{#[^}]+\}\s*$/gm,`$1`);A().use(r).processSync(e)}catch(t){console.warn(`Warning: Could not parse ${e}: ${t}`)}return n},n_=(...e)=>e_(void 0,[...e],void 0,function*(e=process.cwd()){let t=yield ge(e),{contentFilenames:n}=yield fe(e,t),r=[];for(let t of n)r.push(jn.join(e,t));let i=[],a=/* @__PURE__ */ new Set;for(let e of r)try{let t=Xn.readFileSync(e,`utf-8`),n=t_(e,t);n.length>0&&(i.push(...n),a.add(e))}catch(t){console.warn(`Warning: Could not read file ${e}: ${t}`)}return{missingAltAttributes:i,totalFiles:r.length,filesWithIssues:a.size}});var r_=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const i_=()=>r_(void 0,void 0,void 0,function*(){try{D((0,P.jsx)(M,{bold:!0,color:`cyan`,children:`Checking mdx files for accessibility issues...`}));let e=yield n_();if(e.missingAltAttributes.length===0)return D((0,P.jsx)(o,{message:`no accessibility issues found`})),D((0,P.jsxs)(M,{children:[`Checked `,e.totalFiles,` MDX files - all images and videos have alt attributes.`]})),0;let t={};e.missingAltAttributes.forEach(e=>{var n;t[e.filePath]||(t[e.filePath]=[]),(n=t[e.filePath])==null||n.push(e)}),D((0,P.jsxs)(M,{bold:!0,color:`red`,children:[`Found `,e.missingAltAttributes.length,` accessibility issues in`,` `,e.filesWithIssues,` files:`]})),D((0,P.jsx)(M,{}));for(let[e,n]of Object.entries(t)){let t=jn.relative(process.cwd(),e);D((0,P.jsxs)(M,{bold:!0,children:[t,`:`]}));for(let e of n){let t=e.line&&e.column?` (line ${e.line}, col ${e.column})`:``;e.element===`a`?D((0,P.jsxs)(M,{children:[(0,P.jsx)(M,{color:`red`,children:` ✗`}),` Missing text attribute `,(0,P.jsx)(M,{bold:!0,children:e.tagName}),` `,`element`,t]})):D((0,P.jsxs)(M,{children:[(0,P.jsx)(M,{color:`red`,children:` ✗`}),` Missing alt attribute on `,(0,P.jsx)(M,{bold:!0,children:e.tagName}),` `,`element`,t]}))}D((0,P.jsx)(M,{}))}return D((0,P.jsxs)(M,{color:`yellow`,children:[(0,P.jsx)(M,{bold:!0,children:`Recommendation:`}),` Add alt attributes to all images and videos for better accessibility.`]})),1}catch(e){return D((0,P.jsx)(c,{message:`MDX accessibility check failed: ${e instanceof Error?e.message:`Unknown error`}`})),1}});var a_=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const o_=/* @__PURE__ */ new Set([`page`,`site`,`openapi`]),s_=/* @__PURE__ */ new Set([`stats`,`search`,`feedback`,`conversation`]),c_=/* @__PURE__ */ new Set([`set`,`get`,`clear`]),l_=/* @__PURE__ */ new Set([`list`,`view`,`buckets`]),u_=/* @__PURE__ */ new Set([`list`,`view`]);function d_(e){let t=e.filter(e=>typeof e==`string`);if(t.length===0)return``;let n=t[0],r=t[1],i=t[2];if(n===`scrape`&&r!==void 0&&o_.has(r))return`scrape ${r}`;if(n===`config`&&r!==void 0&&c_.has(r))return`config ${r}`;if(n===`analytics`&&r!==void 0&&s_.has(r)){if(r===`conversation`&&i!==void 0&&l_.has(i)){let e=t[3];return i===`buckets`&&e!==void 0&&u_.has(e)?`analytics conversation buckets ${e}`:`analytics conversation ${i}`}return`analytics ${r}`}return n}function f_(){let e=!1;return function(t){return a_(this,void 0,void 0,function*(){if(typeof t._[0]==`string`){if(e)return;e=!0;let n=d_(t._),{cli:r}=Ke();pd({command:n,cliVersion:r,subdomain:mt(`subdomain`)})}})}}const p_=Vn(new URL(`../migrate`,import.meta.url)),m_=(...e)=>Nn(Rn.join(p_,...e),`utf8`),h_=e=>Pn(Rn.join(p_,e)).filter(e=>e.endsWith(`.md`)).map(e=>e.slice(0,-3)).sort(),g_=()=>[m_(`index.md`).trimEnd(),`Topics: ${h_(`topics`).join(`, `)}. Run \`mint migrate --topic <name>\`.`,`Sources: ${h_(`sources`).join(`, `)}. Run \`mint migrate --from <name>\`.`].join(`
558
558
 
@@ -32,7 +32,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
32
32
  `;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Q.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(J.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,`Unterminated template`)},Q.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
33
33
  `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return cd(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!==`0`||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return Qu(t)?``:String.fromCharCode(t)}},Q.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},Q.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(Gu(i,r))this.pos+=i<=65535?1:2;else if(i===92){this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?Wu:Gu)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=cd(o),n=this.pos}else break;t=!1}return e+this.input.slice(n,this.pos)},Q.readWord=function(){var e=this.readWord1(),t=J.name;return this.keywords.test(e)&&(t=Yu[e]),this.finishToken(t,e)},Pd.acorn={Parser:Pd,version:`8.8.2`,defaultOptions:pd,Position:ud,SourceLocation:dd,getLineInfo:fd,Node:nf,TokenType:K,tokTypes:J,keywordTypes:Yu,TokContext:Jd,tokContexts:Yd,isIdentifierChar:Gu,isIdentifierStart:Wu,Token:Pf,isNewLine:Qu,lineBreak:Xu,lineBreakG:Zu,nonASCIIwhitespace:ed};var Rf=xt(Ct(),1),zf=Pd.extend((0,Rf.default)()),Bf=1024;function Vf(e,t){let n=e.type===`CallExpression`&&`callee`in e&&e.callee instanceof nf?e.callee:e;return n.type===`ParenthesizedExpression`&&n.start===t?n.end:void 0}function Hf(e){let t,n=``,r=``,i=e.length*2,a=``;return{parse(e,t={}){return zf.parse(e,Object.assign(Object.assign({},t),{ecmaVersion:t.ecmaVersion??`latest`}))},parseExpressionAt(o,s,c={}){let l=Object.assign(Object.assign({},c),{ecmaVersion:c.ecmaVersion??`latest`}),u=JSON.stringify(Object.assign(Object.assign({},l),{onComment:void 0,onToken:void 0}));if(u!==a&&(r=``,n=``,a=u),s===0&&r.length>o.length&&r.startsWith(o))throw Object.assign(/* @__PURE__ */ SyntaxError(`Unexpected end of expression`),{pos:o.length,raisedAt:o.length});try{let e=zf.parseExpressionAt(o,s,l);return r=``,n=``,e}catch(a){if(s!==0||o.length<Bf||!o.trimStart().startsWith(`(`)||!(a instanceof SyntaxError)||!(`raisedAt`in a)||typeof a.raisedAt!=`number`||a.raisedAt<o.length||n!==``&&o.startsWith(n))throw a;n=o,r=``,t??=e.replace(/(\r\n|\r|\n) {1,2}/g,`$1`);let c=t.indexOf(o);if(c>=1&&t[c-1]===`{`&&t[c+o.length]===`}`&&t.indexOf(o,c+1)===-1)try{let e=t.slice(c);if(e.length>i)throw a;i-=e.length;let n=Vf(zf.parseExpressionAt(e,s,Object.assign(Object.assign({},l),{onComment:void 0,onToken:void 0,preserveParens:!0})),o.search(/\S/));n!==void 0&&n>o.length&&(r=e.slice(0,n))}catch{r=``}throw a}}}}var Uf=i().use(x).use(b).use(f,[`yaml`,`toml`]).freeze(),Wf=Uf().use(a).freeze();function Gf(e){return e.split(/(```[\s\S]*?```|~~~[\s\S]*?~~~)/).map((e,t)=>t%2==0?e.replace(/<!--([\s\S]*?)-->/g,(e,t)=>`{/* ${t} */}`):e).join(``)}function Kf(e,t={}){let n=t.omitHtmlComments??!0?Gf(e):e;return{sanitized:n,preprocessed:_(n,{preserveOriginal:!0})}}var qf=e=>e.children.length===0||e.name===`video`;function Jf(e,t){g(e,e=>{if(!p(e)||!qf(e))return;let n=e.position?.end.offset;n===void 0||t.endsWith(`/>`,n)||(e.data=Object.assign(Object.assign({},e.data),{closingTag:!0}))})}var Yf=[oc({singleTilde:!0}),Mu({estree:!0}),ac([`yaml`,`toml`])],Xf=[...Yf,sc({singleDollarTextMath:!0})];function Zf(e,t){let n=rc(e,{syntax:t?Xf:Yf});if(n instanceof Error)return;let r=n;return g(r,[`mdxJsxFlowElement`,`mdxJsxTextElement`],e=>{if(`attributes`in e)for(let t of e.attributes)delete t.position}),r}function Qf(e,t=!0){let n={acorn:Hf(e)},r=Zf(e,t)??(t?Wf:Uf)().use(x,n).parse(e);return Jf(r,e),t&&y(r,e),r}function $f(e,t={omitHtmlComments:!0}){return Qf(Kf(e,t).preprocessed,t.math)}var ep=`__expressionAttributes`,tp=`__namedExpressionAttributes`,np=`__mintlifyExtraAttrs`,rp=Symbol(`unsupported-estree`);function ip(e,t){if(!e)return rp;switch(e.type){case`Literal`:return e.value;case`TemplateLiteral`:return e.expressions.length===0?e.quasis[0]?.value.cooked??``:rp;case`Identifier`:return t?rp:e.name===`undefined`?void 0:e.name;case`UnaryExpression`:{let n=ip(e.argument,t);return typeof n==`number`?e.operator===`-`?-n:e.operator===`+`?n:rp:rp}case`ArrayExpression`:{let n=[];for(let r of e.elements){if(!r||r.type===`SpreadElement`)return rp;let e=ip(r,t);if(e===rp)return rp;n.push(e)}return n}case`ObjectExpression`:{let n={};for(let r of e.properties){if(r.type!==`Property`||r.computed||r.method||r.kind!==`init`)return rp;let e=r,i=e.key.type===`Identifier`?e.key.name:e.key.type===`Literal`&&(typeof e.key.value==`string`||typeof e.key.value==`number`)?String(e.key.value):void 0;if(!i)return rp;let a=e.shorthand?e.key.type===`Identifier`?ip(e.key,t):rp:ip(e.value,t);if(a===rp)return rp;n[i]=a}return n}default:return rp}}function ap(e,t,n){let r=t?.body[0],i=ip(r?.type===`ExpressionStatement`?r.expression:void 0,n);return i===rp?e.trim()!==``&&!Number.isNaN(Number(e))?Number(e):e:i}function op(e=[]){let t=$(e,{staticOnly:!0}).start;return typeof t==`number`?Number.isInteger(t)?t:1:typeof t==`string`&&/^\s*-?\d+\s*$/.test(t)?Number(t):1}function $(e=[],t={}){let n={},r=[],i={};for(let a of e){if(a.type===`mdxJsxExpressionAttribute`){r.push(a.value);continue}let e=a.value;if(typeof e==`object`&&e){let r=e.value;typeof r==`string`?(i[a.name]=r,n[a.name]=ap(r,`data`in e?e.data?.estree??void 0:void 0,t.staticOnly??!1)):n[a.name]=r}else e==null?n[a.name]=!0:n[a.name]=e}return r.length>0&&(n[ep]=r),Object.keys(i).length>0&&(n[tp]=i),n}function sp(e){try{let[t]=Qf(`<X value={${e}} />`,!1).children;return t?.type!==`mdxJsxFlowElement`||t.attributes.length!==1?e:$(t.attributes).value}catch{return e}}var cp=/* @__PURE__ */ new Set([`ref`,`key`,`dangerouslySetInnerHTML`]);function lp(e){let t=e[tp],n=t&&typeof t==`object`?t:{},r={};for(let[t,i]of Object.entries(e))t!==ep&&t!==tp&&t!==np&&(cp.has(t)||jt.has(t)||t in n&&i===n[t]||(r[t]=i));return r}function up(e,t,n=[]){let r={},i={};for(let[a,o]of Object.entries(e))n.includes(a)||(a===ep||a===tp||t.some(e=>e.name===a)?r[a]=o:i[a]=o);return Object.keys(i).length>0&&(r[np]=i),r}var dp=Yt.filter(e=>e.name!==`type`);function fp(e){return typeof e==`string`?wt.find(t=>t.toLowerCase()===e.toLowerCase())??null:null}function pp(e,t){if(e!==`Callout`)return Object.assign({type:e},up(t,dp));let n=fp(t.type);return Object.assign({type:n},up(t,dp,n?[`type`]:[]))}function mp(e){let t=e.split(` `).reverse();for(let[e,n]of Object.entries(Pt))if(t.includes(n))return e}function hp(e){if(e&&typeof e==`object`&&`width`in e){let t=e.width;if(typeof t==`string`&&t.endsWith(`%`)){let e=parseInt(t.slice(0,-1),10);if(!isNaN(e))return e}}}var gp=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function _p(e,t=!1){let n=$(e.attributes),r=n.className,i;typeof r==`string`&&(i=mp(r));let a=n.style,o;gp(a)&&(o=hp(a));let s=Object.assign(Object.assign({},t?Object.assign({},n):n),{[Mt]:!0});return{type:O.image,attrs:{imgAttributes:s,align:i,width:o}}}function vp(e){return(e.type===`mdxJsxTextElement`||e.type===`mdxJsxFlowElement`)&&e.name===`source`}function yp(e){if(!e.children.every(e=>vp(e)||e.type===`text`&&e.value.trim()===``))return{type:e.type===`mdxJsxTextElement`?O.inlineUnknownTag:O.unknownTag,attrs:{mdxJsxNode:e}};let t=e.children.filter(vp).map(e=>$(e.attributes)),n=$(e.attributes);return{type:O.video,attrs:{videoAttributes:e.data?.closingTag===!0?Object.assign(Object.assign({},n),{[Nt]:!0}):n,sources:t.length>0?t:null}}}var bp=/* @__PURE__ */ new Set([`hidden`,`dark:block`]),xp=/* @__PURE__ */ new Set([`dark:hidden`]);function Sp(e){let t=e.attrs?.imgAttributes;return gp(t)?t:null}function Cp(e){let t=Sp(e)?.className;return typeof t==`string`?t:void 0}function wp(e){if(e.type!==O.image)return!1;let t=Cp(e);if(!t)return!1;let n=t.split(/\s+/);return n.includes(`hidden`)&&n.includes(`dark:block`)}function Tp(e){if(e.type!==O.image)return!1;let t=Cp(e);return t?t.split(/\s+/).includes(`dark:hidden`):!1}function Ep(e,t){if(!e)return;let n=t===`dark`?bp:xp;return e.split(/\s+/).filter(e=>!n.has(e)).join(` `).trim()||void 0}function Dp(e){return Object.entries(e).filter(([e])=>e!==`src`&&e!==`className`).sort(([e],[t])=>e<t?-1:+(e>t))}function Op(e,t,n,r){let i=Ep(n,`light`),a=Ep(r,`dark`),o=i?.split(/\s+/).filter(e=>e!==`block`).join(` `).trim()||void 0;if(a!==i&&a!==o)return!1;let s=Dp(e),c=Dp(t);return s.length===c.length&&JSON.stringify(s)===JSON.stringify(c)}function kp(e){let t=[],n=0;for(;n<e.length;){let r=e[n],i=e[n+1];if(r&&i){let e,a;wp(r)&&Tp(i)?(e=r,a=i):Tp(r)&&wp(i)&&(a=r,e=i);let o=e?Sp(e):null,s=a?Sp(a):null,c=o?.src,l=s?.src;if(e&&a&&o&&s&&typeof c==`string`&&typeof l==`string`&&Op(s,o,Cp(a),Cp(e))){let r=Ep(Cp(a),`light`),i=Object.assign({},s);delete i.src,r?i.className=r:delete i.className,t.push({type:O.image,attrs:{imgAttributes:i,lightSrc:l,darkSrc:c,align:a.attrs?.align??e.attrs?.align,width:a.attrs?.width??e.attrs?.width}}),n+=2;continue}}r&&t.push(r),n++}return t}function Ap(e){if(!e)return null;if(e.type===`image`)return{type:O.inlineImage,attrs:{imgAttributes:{src:e.url,alt:e.alt??void 0,title:e.title??void 0},width:100}};if(e.type===`mdxJsxTextElement`&&e.name===`img`){let t=$(e.attributes),n=100;if(t.width&&typeof t.width==`number`)n=t.width;else if(gp(t.style)){let e=hp(t.style);e&&(n=e)}return{type:O.inlineImage,attrs:{imgAttributes:Object.assign(Object.assign({},t),{[Mt]:!0}),width:n}}}return null}function jp(e,t,n){let r=Mp(e,`icon`),i=Mp(e,`iconType`),a=Np(e),o=Mp(e,`description`)??``,s=[{type:`paragraph`}];if(o)try{let e=$f(o);Pp(e);let r=n(e,t),i=!Array.isArray(r)&&r.type===`doc`&&Array.isArray(r.content)?r.content:Array.isArray(r)?r:[r];i.length>0&&(s=i)}catch{s=[{type:`paragraph`,content:[Wn(o)]}]}let c=Fp(e,t.source),l=up($(e.attributes),ln,[`description`])[np];return{type:O.promptBlock,attrs:Object.assign({icon:r,iconType:i,actions:a},l?{[np]:l}:{}),content:[{type:O.promptDescription,content:s},{type:O.codeBlock,attrs:{language:`text`,__hasGroupParent:!0,__isPromptChild:!0,wrap:!0},content:c?[Wn(c)]:[]}]}}function Mp(e,t){let n=$(e.attributes)[t];if(typeof n!=`string`)return;let r=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);if(r?.type===`mdxJsxAttribute`&&r.value!==null&&typeof r.value==`object`&&n===r.value.value){let e=n.trim();if(e.startsWith("`")&&e.endsWith("`"))return e.slice(1,-1).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\\/g,`\\`)}return n}function Np(e){let t=$(e.attributes,{staticOnly:!0}).actions;return Array.isArray(t)?t.filter(e=>typeof e==`string`):[`copy`]}function Pp(e){g(e,`link`,(e,t,n)=>{if(n&&typeof t==`number`&&e.children.length===1&&e.children[0]?.type===`text`&&e.children[0].value===e.url)return n.children[t]={type:`text`,value:e.url},h})}function Fp(e,t){if(!e.position||!t)return``;let n=e.position.start.offset,r=e.position.end.offset;if(n===void 0||r===void 0)return``;let i=t.slice(n,r),a=i.match(/<\/\s*Prompt\s*>$/);if(!a)return``;let o=-1,s=0,c=!1,l=!1;for(let e=1;e<i.length;e++){let t=i[e]??``,n=i[e-1]??``;if(l)t==="`"&&n!==`\\`&&(l=!1);else if(c)t===c&&n!==`\\`&&(c=!1);else if(t==="`"&&s>0)l=!0;else if(t===`"`||t===`'`)c=t;else if(t===`{`)s++;else if(t===`}`)s--;else if(t===`>`&&s===0){o=e+1;break}}if(o===-1)return``;let u=i.length-a[0].length;return i.slice(o,u).trim()}var Ip={[O.accordion]:Jt,[O.badge]:Qt,[O.card]:Kt,[O.codeBlock]:cn,[O.columns]:qt,[O.expandable]:tn,[O.frame]:en,[O.icon]:sn,[O.mermaidBlock]:un,[O.paramField]:dn,[O.promptBlock]:ln,[O.responseField]:fn,[O.step]:Gt,[O.tab]:Xt,[O.tabs]:Zt,[O.tooltip]:$t,[O.update]:on,[O.visibility]:nn};function Lp(e,t){return up(e,Ip[t]??[])}var Rp=/* @__PURE__ */ new Map([[O.callout,!0],[O.column,!0],[O.expandable,!0],[O.frame,!0],[O.paramField,!0],[`Prompt`,!1],[O.responseField,!0],[O.tab,!0],[O.update,!0],[O.visibility,!1],[O.accordion,!1],[O.accordionGroup,!1],[O.card,!1],[O.codeGroup,!1],[O.columns,!1],[O.requestExample,!1],[O.responseExample,!1],[O.steps,!1],[O.tabs,!1]]);function zp(e,t){let n=t.nodes[e];return!!n&&!n.isInline&&!(n.spec.group??``).split(` `).includes(`block`)}var Bp=(e,t)=>Rp.get(e)&&t.length===0?[{type:`paragraph`}]:t;function Vp(e,t,n,r){if(!e.name)return[];try{return Hp(e,t,n,r)}catch{return[]}}function Hp(e,t,n,r){if(!e.name)return[];if(/^h[1-6]$/.test(e.name)){let r=$(e.attributes),i=Object.keys(r);if(i.length===1&&i[0]===`id`){let i=parseInt(e.name[1]??`1`,10),a=e.children.flatMap(e=>e.type===`paragraph`?e.children:[e]);return{type:`heading`,attrs:{level:i,customId:r.id},content:a.flatMap(e=>n(e,t)).filter(Boolean)}}}if(e.name===`img`)return _p(e);if(e.name===`video`)return yp(e);if(e.name===`Frame`){let n=$(e.attributes);return{type:O.frame,attrs:up(n,en),content:Bp(O.frame,r(e,t))}}let i=wt.includes(e.name);if(e.name===O.steps)return Jp(e,t,n,r);if(e.name===O.accordion)return Xp(e,t,n,r);if(e.name===O.accordionGroup)return{type:O.accordionGroup,attrs:Object.assign(Object.assign({},Lp($(e.attributes),O.accordionGroup)),t.hasGroupParent&&{__hasGroupParent:!0}),content:r(e,Object.assign(Object.assign({},t),{hasGroupParent:!0}))};if(e.name===O.card)return Zp(e,t,n,r);if([O.tabs,O.codeGroup,O.requestExample,O.responseExample].includes(e.name))return Qp(e,t,n,r);if(e.name===O.columns)return $p(e,t,r);if(e.name===O.color)return tm(e);if(e.name===O.tree)return rm(e);if(e.name===O.database)return am(e,t);let a=i?O.callout:e.name;if((i||e.name!==O.step&&Object.values(O).includes(e.name))&&(t.hasGroupParent||!zp(a,t.schema??bn))){let n=$(e.attributes);return{type:a,attrs:Object.assign(Object.assign({},i?pp(e.name,n):Lp(n,a)),t.hasGroupParent&&{__hasGroupParent:!0}),content:Bp(a,r(e,t))}}return e.name===`table`&&!um(e)&&!cm(e)&&!lm(e)?dm(e,t,n,r):Tt.has(e.name)?{type:O.staticHTML,attrs:{tagName:e.name,attributes:$(e.attributes),mdxJsxNode:Yn(e,t)},content:r(e,Object.assign(Object.assign({},t),{hasStaticHtmlParent:!0}))}:e.name===`Prompt`?jp(e,t,n):Et.has(e.name)?{type:O.customComponent,attrs:{name:e.name,attributes:$(e.attributes)},content:r(e,t)}:{type:O.unknownTag,attrs:{mdxJsxNode:e}}}function Up(e){let t=e.children.flatMap(e=>e.type!==`paragraph`||!Gp(e.children)?e:e.children.filter(e=>e.type===`mdxJsxTextElement`).map(e=>Object.assign(Object.assign({},e),{type:`mdxJsxFlowElement`})));return Object.assign(Object.assign({},e),{children:t})}function Wp(e,t){return Up(e).children.filter(e=>e.type===`mdxJsxFlowElement`&&(t===void 0||e.name===t))}function Gp(e){return e.every(e=>e.type===`mdxJsxTextElement`&&Kp(e.name)||e.type===`text`&&e.value.trim()===``)}function Kp(e){return!!e&&!Tt.has(e)&&!Dt.has(e)}function qp(e,t,n,r){let i=typeof t==`string`&&t?me(t).flatMap(e=>r(e,n)):[];return Object.assign({type:e},i.length>0?{content:i}:{})}function Jp(e,t,n,r){let i=Up(e).children,a=[];for(let t of i)if(t.type!==`text`||t.value.trim()!==``){if(t.type!==`mdxJsxFlowElement`||t.name!==O.step)return{type:O.unknownTag,attrs:{mdxJsxNode:e}};a.push(t)}let o=a.map((e,i)=>Yp(e,t,n,r,{index:i,isLast:i===a.length-1}));return{type:O.steps,attrs:Object.assign(Object.assign({},up($(e.attributes),[])),t.hasGroupParent&&{__hasGroupParent:!0}),content:o}}function Yp(e,t,n,r,i){let a=$(e.attributes),o=a.title,s=r(e,t);return{type:O.step,attrs:Object.assign(Object.assign(Object.assign({},up(a,Gt,[`title`])),t.hasGroupParent&&{__hasGroupParent:!0}),{__childIndex:i.index,__isLastInGroup:i.isLast}),content:[qp(O.stepTitle,o,t,n),{type:O.stepBody,content:s.length>0?s:[{type:`paragraph`}]}]}}function Xp(e,t,n,r){let i=$(e.attributes),a=i.title,o=r(e,t),s=qp(O.accordionTitle,a,t,n),c={type:O.accordionBody,content:o.length>0?o:[{type:`paragraph`}]};return{type:O.accordion,attrs:Object.assign(Object.assign({},up(i,Jt,[`title`])),t.hasGroupParent&&{__hasGroupParent:!0}),content:[s,c]}}function Zp(e,t,n,r){let i=$(e.attributes),a=i.title,o=r(e,t),s=qp(O.cardTitle,a,t,n),c={type:O.cardBody,content:o.length>0?o:[{type:`paragraph`}]};return{type:O.card,attrs:Object.assign(Object.assign({},up(i,Kt,[`title`])),t.hasGroupParent&&{__hasGroupParent:!0}),content:[s,c]}}function Qp(e,t,n,r){let i={[O.tabs]:O.tab,[O.codeGroup]:O.codeBlock,[O.requestExample]:O.codeBlock,[O.responseExample]:O.codeBlock},a=e.children.filter(e=>e.type===`code`),o=t=>e.name===O.tabs?up(t,Zt):up(t,[]);if(a.length>0)return{type:e.name??O.codeGroup,attrs:Object.assign(Object.assign({},o($(e.attributes))),t.hasGroupParent&&{__hasGroupParent:!0}),content:a.map((e,r)=>{let i=n(e,Object.assign(Object.assign({},t),{hasGroupParent:!0,isHidden:r!==0}));return Array.isArray(i)?i[0]??{type:`paragraph`}:i})};let s=Wp(e);if(s.length>0){let n=i[e.name??``]??O.tab,a=e=>n===O.tab?up(e,Xt):e,c=s.map((i,o)=>({type:n,attrs:Object.assign(Object.assign({},a($(i.attributes))),{__isHidden:o!==0,__hasGroupParent:!0}),content:Bp(n,r(i,Object.assign(Object.assign({},t),{hasGroupParent:e.name!==O.tabs,isHidden:e.name!==O.tabs&&o!==0})))}));return{type:e.name??O.tabs,attrs:Object.assign(Object.assign({},o($(e.attributes))),t.hasGroupParent&&{__hasGroupParent:!0}),content:c}}return r(e,t).length>0?{type:O.unknownTag,attrs:{mdxJsxNode:e}}:{type:e.name??O.tabs,attrs:o($(e.attributes)),content:[]}}function $p(e,t,n){let r=up($(e.attributes),qt),i=n(e,Object.assign(Object.assign({},t),{hasGroupParent:!0})).map(e=>e.type===O.column?Object.assign(Object.assign({},e),{content:Bp(O.column,e.content??[])}):e);return{type:O.columns,attrs:Object.assign(Object.assign({},r),t.hasGroupParent&&{__hasGroupParent:!0}),content:i}}function em(e){let t=$(e.attributes),n=t.__namedExpressionAttributes;return{type:`item`,name:typeof t.name==`string`?t.name:void 0,value:t.value,rawValueExpr:n?.value}}function tm(e){let t=$(e.attributes),n=typeof t.variant==`string`?t.variant:null,r=up(t,[],[`variant`]),i=Wp(e).map(e=>{if(e.name===`Color.Item`)return em(e);if(e.name===`Color.Row`){let t=$(e.attributes),n=Wp(e,`Color.Item`).map(em);return{type:`row`,title:typeof t.title==`string`?t.title:void 0,items:n}}return null}).filter(e=>e!==null);return{type:O.color,attrs:Object.assign({variant:n,colorData:i},r)}}function nm(e){return Wp(e).map(e=>{if(e.name===`Tree.File`){let t=$(e.attributes);return{type:`file`,name:typeof t.name==`string`?t.name:void 0}}if(e.name===`Tree.Folder`){let t=$(e.attributes);return{type:`folder`,name:typeof t.name==`string`?t.name:void 0,defaultOpen:typeof t.defaultOpen==`boolean`?t.defaultOpen:void 0,openable:typeof t.openable==`boolean`?t.openable:void 0,children:nm(e)}}return null}).filter(e=>e!==null)}function rm(e){let t=up($(e.attributes),[]);return{type:O.tree,attrs:Object.assign({treeData:nm(e)},t)}}var im=[`view`,`sort`,`filter`,`groupBy`,`calendarBy`];function am(e,t){let n=Fn(e.attributes),r=$(In(e.attributes));return t.databases===!0&&n!==On&&(t.schema??bn).nodes[O.database]&&e.children.length===0&&!(ep in r)&&!(tp in r)&&wn(r.id)&&im.every(e=>r[e]===void 0||typeof r[e]==`string`)?{type:O.database,attrs:Object.assign(Object.assign({},up(r,an)),{sql:n})}:{type:O.unknownTag,attrs:{mdxJsxNode:e}}}var om=/* @__PURE__ */ new Set([`colspan`,`colSpan`,`rowspan`,`rowSpan`]),sm=/* @__PURE__ */ new Set([`class`,`className`]);function cm(e){return e.attributes.some(e=>e.type===`mdxJsxAttribute`&&sm.has(e.name))}function lm(e){return pm(e.children).some(e=>(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&(e.name===`tfoot`||e.name===`caption`||e.name===`thead`&&mm(e.children,`tr`).length>1))}function um(e){return xm(e)&&e.attributes.some(e=>e.type===`mdxJsxAttribute`&&om.has(e.name))?!0:`children`in e&&e.children.some(e=>um(e))}function dm(e,t,n,r){let i=[];for(let t of pm(e.children))ym(t)?i.push(t):(fm(t,`thead`)||fm(t,`tbody`))&&i.push(...pm(t.children).filter(ym));if(i.length===0)return{type:`table`,content:[]};let a=_m(e);return{type:`table`,content:i.map((e,i)=>({type:`tableRow`,content:bm(e).map((e,o)=>{let s=e.name===`th`||i===0,c=a[o],l=$(e.attributes).style,u=(typeof l==`string`?l:l&&typeof l==`object`?Object.entries(l).map(([e,t])=>`${e}: ${String(t)}`).join(`; `):``).match(/text(?:-align|Align):\s*(left|center|right)/i),d=Sm(e,t,n,r);return{type:s?`tableHeader`:`tableCell`,attrs:{align:u?.[1]??null,colwidth:c?[c]:null},content:d.length>0?d:[{type:`paragraph`}]}})}))}}function fm(e,t){return(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&e.name===t}function pm(e){return e.flatMap(e=>e.type===`paragraph`?e.children:[e])}function mm(e,t){return pm(e).filter(e=>fm(e,t))}function hm(e){let t=$(e.attributes),n=t.style,r=typeof n==`string`?n.match(/(?:^|;)\s*width:\s*([^;]+)/i)?.[1]:n&&typeof n==`object`?n.width:void 0,i=t.width??r;if(typeof i==`number`)return i>0?i:null;if(typeof i!=`string`)return null;let a=i.trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/),o=a?.[1]?Number(a[1]):NaN;return o>0?o:null}function gm(e){let t=Number($(e.attributes).span);return Number.isInteger(t)&&t>0?t:1}function _m(e){let t=mm(e.children,`col`);for(let n of mm(e.children,`colgroup`))t.push(...mm(n.children,`col`));return t.flatMap(e=>Array(gm(e)).fill(hm(e)))}function vm(e){return Array.isArray(e)?e.filter(Boolean):[e]}function ym(e){return(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&e.name===`tr`}function bm(e){let t=[];for(let n of e.children)if(xm(n))t.push(n);else if(n.type===`paragraph`)for(let e of n.children)xm(e)&&t.push(e);return t}function xm(e){return(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&(e.name===`td`||e.name===`th`)}function Sm(e,t,n,r){let i=[];for(let a of e.children)if(a.type!==`mdxJsxFlowElement`&&a.type!==`mdxJsxTextElement`)i.push(...vm(n(a,t)));else if(a.name===`p`)i.push({type:`paragraph`,content:Cm(a,t,n,r)});else if(a.name&&/^h[1-6]$/.test(a.name)){let e=parseInt(a.name[1]??`1`,10),o=$(a.attributes);i.push({type:`heading`,attrs:{level:e,id:o.id??null},content:Cm(a,t,n,r)})}else if(a.name===`ul`||a.name===`ol`){let e=a.children.filter(e=>(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`)&&e.name===`li`).map(e=>({type:`listItem`,content:[{type:`paragraph`,content:Cm(e,t,n,r)}]}));e.length>0&&i.push({type:a.name===`ol`?`orderedList`:`bulletList`,attrs:a.name===`ol`?{start:op(a.attributes)}:{},content:e})}else i.push(...vm(n(a,t)));return Jn(i,t.schema??bn)}function Cm(e,t,n,r){return e.type===`mdxJsxFlowElement`?r(e,t).flatMap(e=>e.type===`paragraph`?e.content??[]:[e]):e.children.flatMap(e=>vm(n(e,t)))}function wm(e,t,n){if(e.name===`Tooltip`){let r=up($(e.attributes),$t),i=n(e,t);return{type:O.tooltip,attrs:r,content:i.length>0?i:[]}}if(e.name===`img`)return _p(e,!0);if(e.name===`video`)return yp(e);if(e.name===`br`)return{type:`hardBreak`};if(e.name===`kbd`){let{text:t}=Gn(e);return Wn(t,[{type:`kbd`}])}if(e.name===`Icon`)return{type:O.icon,attrs:up($(e.attributes),sn)};if(e.name===`Badge`){let t=up($(e.attributes),Qt),{text:n}=Gn(e);return{type:O.badge,attrs:t,content:n?[{type:`text`,text:n}]:[]}}if(e.name===`u`||e.name===`sub`||e.name===`sup`){let{text:t}=Gn(e);return{type:`text`,text:t,marks:Kn(e)}}if(e.name&&wt.includes(e.name))return{type:O.callout,attrs:pp(e.name,$(e.attributes)),content:[{type:`paragraph`,content:n(e,t)}]};if(e.name&&Et.has(e.name))return{type:O.customComponent,attrs:{name:e.name,attributes:$(e.attributes)},content:Jn(n(e,t),t.schema??bn)};if(e.name&&Tt.has(e.name)){let r=t.schema??bn,i=n(e,Object.assign(Object.assign({},t),{hasStaticHtmlParent:!0})),a=i.some(e=>!qn(e,r));return{type:a?O.staticHTML:O.inlineStaticHTML,attrs:{tagName:e.name,attributes:$(e.attributes),mdxJsxNode:Yn(e,t)},content:a?Jn(i,r):i}}return e.name?{type:O.inlineUnknownTag,attrs:{mdxJsxNode:e}}:{type:`paragraph`,content:n(e,t)}}var Tm=e=>{let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&/\s/.test(e[r]);)r++;if(r>=n)break;let i=``;for(;r<n&&!/\s/.test(e[r]);){let t=e[r];if(t===`"`||t===`'`){let a=t;for(i+=t,r++;r<n&&e[r]!==a;)e[r]===`\\`&&r+1<n?(i+=e[r]+e[r+1],r+=2):(i+=e[r],r++);r<n&&(i+=e[r],r++)}else if(t===`{`){for(;r<n&&e[r]!==`}`;)i+=e[r],r++;r<n&&(i+=e[r],r++)}else i+=t,r++}i&&t.push(i)}return t},Em=e=>{let t=e.match(/^\{(.*)\}$/);return t?t[1]??``:Om(e)},Dm=e=>e.replace(/\\(["'\\])/g,`$1`),Om=e=>{let t=e.match(/^(['"])(.*)\1$/);return t?Dm(t[2]??``):e.startsWith(`"`)||e.startsWith(`'`)?e.slice(1):e},km=e=>{if(!e)return{};let t={},n=Tm(e.trim()),r=[];for(let e of n){let n=e.match(/^highlight=(.+)$/);if(n){let e=Em(n[1]??``);e&&(t.highlight=e);continue}let i=e.match(/^\{([\d,\-]+)\}$/);if(i){t.highlight=i[1]??``;continue}let a=e.match(/^focus=(.+)$/);if(a){let e=Em(a[1]??``);e&&(t.focus=e);continue}let o=e.match(/^icon=(.+)$/);if(o){t.icon=Om(o[1]??``);continue}let s=e.match(/^title=(.+)$/);if(s){let e=Om(s[1]??``);e&&(t.filename=e,t.filenameSyntax=`title`)}else e===`expandable`||e===`lines`||e===`wrap`||e===`twoslash`||e===`nocopy`?t[e]=!0:e.includes(`=`)||r.push(e)}return t.filename===void 0&&r.length>0&&(t.filename=r.join(` `)),t};function Am(e){let t=e.split(`
34
34
  `),n=[],r=[],i=[];for(let e=0;e<t.length;e++){let a=t[e]??``,o=a.match(/^(.*?)\s*(?:\/\/|\/\*|#|--|<!--)\s*\[!code \+\+\]\s*(?:\*\/|-->)?\s*$/),s=a.match(/^(.*?)\s*(?:\/\/|\/\*|#|--|<!--)\s*\[!code --\]\s*(?:\*\/|-->)?\s*$/);o?(n.push(e+1),i.push(o[1]??``)):s?(r.push(e+1),i.push(s[1]??``)):i.push(a)}return{cleanedCode:i.join(`
35
- `),addLines:n,removeLines:r}}function jm(e){if(!e)return[];let t=[],n=e.replace(/[{}[\]]/g,``).split(`,`);for(let e of n){let n=e.trim(),r=n.match(/^(\d+)-(\d+)$/);if(r){let e=parseInt(r[1]??`0`,10),n=parseInt(r[2]??`0`,10);for(let r=e;r<=n;r++)t.push(r)}else{let e=parseInt(n,10);isNaN(e)||t.push(e)}}return t}function Mm(e){if(e.length===0)return``;let t=[...new Set(e)].sort((e,t)=>e-t),n=[],r=t[0]??0,i=r;for(let e=1;e<t.length;e++){let a=t[e]??0;a===i+1||(n.push(r===i?String(r):`${r}-${i}`),r=a),i=a}return n.push(r===i?String(r):`${r}-${i}`),n.join(`,`)}function Nm(e){let t=/* @__PURE__ */ new Set([`html`,`xml`,`svg`,`mdx`,`md`,`markdown`]),n=/* @__PURE__ */ new Set([`python`,`ruby`,`bash`,`sh`,`shell`,`zsh`,`yaml`,`yml`,`toml`,`perl`,`r`,`elixir`,`dockerfile`,`makefile`,`cmake`]),r=/* @__PURE__ */ new Set([`sql`,`lua`,`haskell`,`elm`]),i=/* @__PURE__ */ new Set([`css`,`scss`,`sass`,`less`,`stylus`]);return t.has(e)?{open:`<!--`,close:`-->`}:n.has(e)?{open:`#`,close:``}:r.has(e)?{open:`--`,close:``}:i.has(e)?{open:`/*`,close:`*/`}:{open:`//`,close:``}}var Pm=/* @__PURE__ */ new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`ul`,`ol`]);function Fm(e){return e.type!==`text`||`value`in e&&typeof e.value==`string`&&e.value.trim()!==``}function Im(e){return e?Array.isArray(e)?e.filter(Boolean):[e]:[]}function Lm(e,t,n){return e.flatMap(e=>{if(e.type===`text`){let{text:t,marks:n}=Gn(e);return[Wn(t,n)]}if(e.type===`image`||e.type===`mdxJsxTextElement`&&e.name===`img`){let t=Ap(e);return t?[t]:[]}return Im(n(e,t))}).filter(Boolean)}function Rm(e,t,n){let r=e.findIndex(Fm);if(r===-1)return null;let i=e.length-1;for(;i>r&&!Fm(e[i]);)i--;return{type:`paragraph`,content:Lm(e.slice(r,i+1),t,n)}}function zm(e,t,n){if(e.some(e=>e.type===`mdxJsxTextElement`&&e.name!=null&&Pm.has(e.name))){let r=[],i=[],a=()=>{let e=Rm(i,t,n);e&&r.push(e),i=[]};for(let o of e){if(o.type===`mdxJsxTextElement`&&o.name!=null&&Pm.has(o.name)){if(a(),/^h[1-6]$/.test(o.name)){let e=parseInt(o.name[1]??`1`,10);r.push({type:`heading`,attrs:{level:e},content:Lm(o.children,t,n)});continue}if(o.name===`ul`||o.name===`ol`){let e=o.children.filter(e=>e.type===`mdxJsxTextElement`&&e.name===`li`).map(e=>({type:`listItem`,content:[{type:`paragraph`,content:Lm(e.children,t,n)}]}));e.length>0&&r.push({type:o.name===`ol`?`orderedList`:`bulletList`,attrs:o.name===`ol`?{start:op(o.attributes)}:{},content:e});continue}}i.push(o)}return a(),r}if(e.every(e=>e.type===`text`||e.type===`emphasis`||e.type===`strong`||e.type===`link`||e.type===`linkReference`||e.type===`inlineCode`||e.type===`delete`||e.type===`image`||e.type===`break`||e.type===`inlineMath`||e.type===`footnoteReference`||e.type===`mdxTextExpression`||e.type===`mdxJsxTextElement`)){let r=Rm(e,t,n);return r?[r]:[]}return e.flatMap(e=>Im(n(e,t)))}function Bm(e,t,n,r){let i=t.schema??bn;if(e.children.some(e=>e.type===`image`||e.type===`mdxJsxTextElement`&&e.name===`img`)){if(e.children.some(e=>e.type===`text`||e.type===`emphasis`||e.type===`strong`||e.type===`link`||e.type===`linkReference`||e.type===`inlineCode`||e.type===`delete`||e.type===`mdxJsxTextElement`&&e.name!==`img`)){let r=[];for(let i of e.children)if(i.type===`image`||i.type===`mdxJsxTextElement`&&i.name===`img`){let e=Ap(i);e&&r.push(e)}else{let e=n(i,t);Array.isArray(e)?r.push(...e):r.push(e)}return Vm(r,i)}let r=[];for(let i of e.children)if(i.type===`image`||i.type===`mdxJsxTextElement`&&i.name===`img`){let e=n(i,t);Array.isArray(e)?r.push(...e):r.push(e)}return r.length>0?r:[]}let a=r(e,t);return a.every(e=>qn(e,i))?{type:`paragraph`,content:a}:Vm(a,i)}function Vm(e,t){return Jn(kp(e),t).map(e=>e.type===`paragraph`?Hm(e):e).filter(e=>e.type!==`paragraph`||(e.content?.length??0)>0)}function Hm(e){let t=[...e.content??[]],n=t[0];n?.type===`text`&&n.text&&!n.marks?.some(e=>e.type===`code`)&&(t[0]=Object.assign(Object.assign({},n),{text:n.text.replace(/^\s+/,``)}));let r=t.length-1,i=t[r];return i?.type===`text`&&i.text&&!i.marks?.some(e=>e.type===`code`)&&(t[r]=Object.assign(Object.assign({},i),{text:i.text.replace(/\s+$/,``)})),Object.assign(Object.assign({},e),{content:t.filter(e=>e.type!==`text`||e.text!==``)})}function Um(e,t,n){let r=e.children,i=e.align||[],a=r[0]?.children.length??0;return{type:`table`,content:r.map((e,r)=>{let o=e.children.reduce((e,t,n)=>t.children.length>0?Math.max(e,n+1):e,a);return{type:`tableRow`,content:e.children.slice(0,o).map((e,a)=>{let o=zm(e.children,t,n),s=i[a];return{type:r===0?`tableHeader`:`tableCell`,attrs:{align:s??null},content:o.length>0?o:[{type:`paragraph`,content:[]}]}})}})}}function Wm(e,t){if(e.lang===`mermaid`&&!t.hasGroupParent){if(!e.value)return[];let t=e.meta||``,n=t.match(/placement=["']([^"']+)["']/),r=t.match(/actions=\{(true|false)\}/);return{type:O.mermaidBlock,attrs:{placement:n?.[1]||`bottom-right`,actions:r?r[1]===`true`:null},content:[{type:O.codeBlock,attrs:{language:`text`,__hasGroupParent:!0,__isMermaidChild:!0},content:[Wn(e.value)]}]}}let n=km(e.meta||``),r=e.lang===`nocopy`;r&&n.nocopy===void 0&&(n.nocopy=!0);let{cleanedCode:i,addLines:a,removeLines:o}=Am(e.value||``),s={};return a.length>0&&(s.add=a),o.length>0&&(s.remove=o),Object.assign({type:O.codeBlock,attrs:Object.assign(Object.assign(Object.assign({language:r?`text`:e.lang||null},n),s),{__isHidden:t.isHidden,__hasGroupParent:t.hasGroupParent})},i?{content:[Wn(i)]}:{})}function Gm(e,t=``,n){let r=n?.schema??bn,i=Un(e),a=/* @__PURE__ */ new Map;g(e,e=>{e.type===`definition`&&!a.has(e.identifier)&&a.set(e.identifier,e);let t=e.type===`mdxJsxTextElement`&&e.name===`Prompt`;e.type!==`list`&&e.type!==`mdxJsxFlowElement`&&!t&&delete e.position});let o=Km(e,{source:t,frontmatter:i,schema:r,definitions:a,databases:n?.databases===!0}),s=Jn(Array.isArray(o)?o:o.content??[],r),c={type:`doc`,content:s.length>0?s:[]};return{doc:He.fromJSON(r,c),frontmatter:i}}function Km(e,t){if(!e)return[];switch(e.type){case`root`:return{type:`doc`,content:Zm(e,t)};case`heading`:return{type:`heading`,attrs:{level:e.depth},content:Zm(e,t)};case`paragraph`:return Bm(e,t,Km,Zm);case`text`:return e.value?{type:`text`,text:e.value.replace(/\n/g,` `)}:[];case`blockquote`:{let n=Zm(e,t);return{type:`blockquote`,content:n.length?n:[{type:`paragraph`}]}}case`list`:{let n=e.ordered?{start:e.start??1}:{},r=e.children.map(e=>Km(e,t));return{type:e.ordered?`orderedList`:`bulletList`,attrs:n,content:r.flat()}}case`listItem`:{let n=Zm(e,t);return{type:`listItem`,attrs:{checked:e.checked??null},content:n[0]?.type===`paragraph`?n:[{type:`paragraph`,content:[]},...n]}}case`table`:return Um(e,t,Km);case`tableRow`:case`tableCell`:return[];case`thematicBreak`:return{type:`horizontalRule`};case`break`:return{type:`hardBreak`};case`image`:return{type:O.image,attrs:{imgAttributes:{src:e.url,alt:e.alt??void 0,title:e.title??void 0}}};case`code`:return Wm(e,t);case`emphasis`:case`strong`:case`link`:case`delete`:return qm(e.children,Kn(e),t);case`linkReference`:{let n=Jm(e,t);return n?qm(e.children,[n],t):{type:O.inlineUnknownTag,attrs:{mdxJsxNode:e}}}case`inlineCode`:{let{text:t,marks:n}=Gn(e);return Wn(t,n)}case`math`:return e.value?{type:O.blockMath,attrs:{expression:e.value}}:[];case`inlineMath`:return e.value?{type:O.inlineMath,attrs:{expression:e.value}}:[];case`yaml`:return[];case`mdxJsxTextElement`:{let n=Ym(e,[],t);if(n)return n;if(!e.name||!Rp.has(e.name)||zp(e.name,t.schema??bn))return wm(e,t,Zm);let r=Vp(Object.assign(Object.assign({},e),{type:`mdxJsxFlowElement`,children:e.children.length>0?[{type:`paragraph`,children:e.children}]:[]}),t,Km,Qm);return(Array.isArray(r)?r:[r]).length>0?r:wm(e,t,Zm)}case`mdxJsxFlowElement`:return Vp(e,t,Km,Qm);case`mdxjsEsm`:return{type:O.mdxJsEsm,attrs:{mdastNode:e}};case`mdxFlowExpression`:return{type:O.unknownTag,attrs:{mdxJsxNode:e,__isHidden:!0}};case`mdxTextExpression`:case`footnoteReference`:return{type:O.inlineUnknownTag,attrs:{mdxJsxNode:e}};case`definition`:return{type:O.unknownTag,attrs:{mdxJsxNode:e,__isHidden:!0}};default:return{type:O.unknownTag,attrs:{mdxJsxNode:e}}}}function qm(e,t,n){let r=[];for(let i of e)if(i.type===`text`)i.value&&r.push(Wn(i.value.replace(/\n/g,` `),t));else if(i.type===`break`)r.push({type:`hardBreak`});else if(i.type===`inlineCode`)r.push(Wn(i.value||``,[...t,{type:`code`}]));else if(i.type===`linkReference`){let e=Jm(i,n);if(e)r.push(...qm(i.children,[...t,e],n));else{let e=Km(i,n);r.push(...Array.isArray(e)?e:[e])}}else if(i.type===`emphasis`||i.type===`strong`||i.type===`link`||i.type===`delete`)r.push(...qm(i.children,[...t,...Kn(i)],n));else if(i.type===`mdxJsxTextElement`&&i.name===`Link`){let e=Ym(i,t,n);if(e)r.push(...e);else{let e=Km(i,n);r.push(...Array.isArray(e)?e:[e])}}else if(i.type===`mdxJsxTextElement`&&(i.name===`u`||i.name===`sub`||i.name===`sup`))r.push(...qm(i.children,[...t,...Kn(i)],n));else if(i.type===`mdxJsxTextElement`&&i.name===`kbd`){let{text:e}=Gn(i);e&&r.push(Wn(e,[...t,{type:`kbd`}]))}else if(i.type===`image`||i.type===`mdxJsxTextElement`&&i.name===`img`){let e=Ap(i);e&&r.push(t.length>0?Object.assign(Object.assign({},e),{marks:t}):e)}else{let e=Km(i,n),a=Array.isArray(e)?e:[e],o=i.type===`mdxTextExpression`&&t.length>0?a.map(e=>Object.assign(Object.assign({},e),{marks:t})):a;r.push(...o)}return r}function Jm(e,t){let n=t.definitions?.get(e.identifier);if(n)return{type:`link`,attrs:{href:n.url,title:n.title??void 0,referenceLabel:e.label??n.label??e.identifier}}}function Ym(e,t,n){let r=Xm(e,n);if(!r)return;let i=qm(e.children,[...t,r],n),a=n.schema??bn,o=i.every(e=>{if(!qn(e,a)||e.type!==`text`&&e.type!==O.inlineImage&&e.type!==O.inlineUnknownTag)return!1;let t=e.marks?.filter(e=>e.type===`link`)??[];return t.length===1&&t[0]?.attrs?.mdxLinkAttributes!==void 0});return i.length>0&&o?i:void 0}function Xm(e,t){if(e.name!==`Link`||e.attributes.some(e=>e.type===`mdxJsxExpressionAttribute`))return;let n=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===`href`);if(!n||typeof n.value!=`string`)return;let r=$(e.attributes),i=t.nextMdxLinkId??0;return t.nextMdxLinkId=i+1,{type:`link`,attrs:{href:n.value,title:typeof r.title==`string`?r.title:void 0,mdxLinkAttributes:r,mdxLinkId:i}}}function Zm(e,t){return kp(e.children.flatMap(e=>Km(e,t)).filter(Boolean))}function Qm(e,t){return Jn(kp(Up({children:e.children}).children.flatMap(e=>e.type===`mdxJsxFlowElement`?Vp(e,t,Km,Qm):Km(e,t)).filter(Boolean)),t.schema??bn)}function $m(e,t){return Gm($f(e,t),e,t)}var eh=i().use(b).use(f,[`yaml`,`toml`]).use(a).freeze(),th=/(<\/?(?:aside|details)\b[^>]*>|<summary\b[^>]*>[\s\S]*?<\/summary>)/i,nh=/^<summary\b[^>]*>([\s\S]*?)<\/summary>$/i,rh=/<(area|br|col|embed|hr|img|input|source|track|wbr)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*\/?>/gi,ih=/^<([a-z][\w-]*)\b[^>]*(?<!\/)>$/i,ah=/<\/?[a-z][^>]*>/gi,oh=/* @__PURE__ */ new Set([`paragraph`,`heading`,`tableCell`,`emphasis`,`strong`,`delete`,`link`,`linkReference`]),sh=e=>`open`in e||`close`in e||`summary`in e,ch=e=>(e?.type===`mdxJsxFlowElement`||e?.type===`mdxJsxTextElement`)&&e.name===`summary`,lh=({tag:e,title:t,children:n})=>({type:`mdxJsxFlowElement`,name:e===`aside`?`Callout`:`Accordion`,attributes:e===`details`?[{type:`mdxJsxAttribute`,name:`title`,value:t??``}]:[],children:n});function uh(e){let[t]=e;if(ch(t))return e.shift(),Gn(t).text.trim();if(t?.type!==`paragraph`||!ch(t.children[0]))return;let n=t.children.shift();return Gn(t).text.trim()||e.shift(),Gn(n).text.trim()}function dh(e){g(e,`mdxJsxFlowElement`,(e,t,n)=>{if(!n||t===void 0||e.name!==`aside`&&e.name!==`details`)return;let r=e.children,i=e.name===`details`?uh(r):void 0;n.children[t]=lh({tag:e.name,title:i,children:r})})}var fh=/^\s*\/\*[\s\S]*\*\/\s*$/;function ph(e){g(e,(e,t,n)=>{if(e.type!==`mdxTextExpression`&&e.type!==`mdxFlowExpression`||!n||t===void 0||fh.test(e.value))return;let r={type:`text`,value:`{${e.value}}`};n.children[t]=e.type===`mdxFlowExpression`?{type:`paragraph`,children:[r]}:r})}function mh(e){try{return $f(e.replace(rh,`<$1$2 />`)).children}catch{let t=e.replace(ah,``).trim();return t?[{type:`paragraph`,children:[{type:`text`,value:t}]}]:[]}}function hh(e){return mh(e).flatMap(e=>e.type===`paragraph`?e.children:e.type===`mdxJsxFlowElement`?[Object.assign(Object.assign({},e),{type:`mdxJsxTextElement`})]:[])}function gh(e){let t=e.split(th);return t.length===1?mh(e):t.flatMap((e,t)=>{if(t%2==0)return e.trim()?bh(e).children:[];let n=nh.exec(e);return n?[{summary:(n[1]??``).replace(ah,``).trim()}]:e.startsWith(`</`)?[{close:!0}]:[{open:/^<aside/i.test(e)?`aside`:`details`}]})}function _h(e){let t=[],n=[],r=()=>n.at(-1)?.children??t,i=()=>{let e=n.pop();e&&r().push(lh(e))};for(let a of e)if(!sh(a))r().push(a);else if(`open`in a)n.push({tag:a.open,children:[]});else if(`close`in a)i();else{let e=n.at(-1);e?e.title=a.summary:t.push({type:`paragraph`,children:[{type:`text`,value:a.summary}]})}for(;n.length>0;)i();return t}function vh(e,t,n){let r=e[t],i=r?.type===`html`?ih.exec(r.value)?.[1]:void 0,a=(r?.position)?.start.offset;if(!i||a===void 0)return;let o=e.findIndex((e,n)=>n>t&&e.type===`html`&&e.value.toLowerCase()===`</${i}>`.toLowerCase()),s=(e[o]?.position)?.end.offset;if(o!==-1&&s!==void 0)return{nodes:hh(n.slice(a,s)),skip:o-t}}function yh(e,t){let n=oh.has(e.type),r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i];if(a.type!==`html`)`children`in a&&yh(a,t),r.push(a);else if(!n)r.push(...gh(a.value));else{let n=vh(e.children,i,t);r.push(...n?.nodes??hh(a.value)),i+=n?.skip??0}}e.children=r.some(sh)?_h(r):r}function bh(e){let t=eh.parse(e);return y(t,e),yh(t,e),t}function xh(e){try{let t=$f(e);return dh(t),ph(t),t}catch{return bh(e)}}function Sh(e,t){return Gm(xh(e),e,t)}function Ch(e){return e!==void 0&&e!==``}function wh(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>Ch(t)))}function Th(){let e=/* @__PURE__ */ new Set,t=/* @__PURE__ */ new Set,n=d.shape;for(let[r,i]of Object.entries(n)){let n=i instanceof te?i.unwrap():i;n instanceof ee&&e.add(r),n instanceof ne&&t.add(r),n instanceof S&&n.options.every(e=>e instanceof ne)&&t.add(r)}return{booleanKeys:e,arrayKeys:t}}var{booleanKeys:Eh,arrayKeys:Dh}=Th(),Oh=Array.from(Eh),kh=Array.from(Dh);function Ah(e){try{return JSON.parse(e)}catch{return e}}var jh=/* @__PURE__ */ new Set([`automerge`]);function Mh(e,t){if(Eh.has(e)||jh.has(e))return t===`true`;if(Dh.has(e)){let e=Ah(t);return Array.isArray(e)?e:t}return t}var Nh={lineWidth:-1,quotingType:`"`,forceQuotes:!0},Ph=/* @__PURE__ */ new Set([`background`,`eyebrow`]);function Fh(e,t){return Array.isArray(e)?e.map(e=>Fh(e)):typeof e==`object`&&e&&!(e instanceof Date)?Object.fromEntries(Object.entries(e).filter(([e,n])=>Ch(n)||n===``&&!!t?.has(e)).map(([e,t])=>[e,Fh(t)])):e}function Ih(e,t){let n=Eh.has(e),r=t;n&&(r===`true`||r===`false`)&&(r=r===`true`),r===void 0&&(r=null);let i=e===`thumbnail`?Ph:void 0;return u.dump({[e]:Fh(r,i)},Nh).trimEnd()}function Lh(e){if(!e||!e.startsWith(`<`)||!e.endsWith(`>`))return!1;try{let t=Hf(e).parseExpressionAt(e,0,{sourceType:`module`});return t.type===`JSXElement`&&t.end===e.length}catch{return!1}}function Rh(e){return e.textContent}var zh=/^[A-Za-z_$][\w$]*$/;function Bh(e){return e==null?null:typeof e==`object`?`{${Array.isArray(e)?Vh(e):Hh(e,!0)}}`:typeof e==`string`?e===``?`""`:Lh(e)?`{${e}}`:e.includes(`&`)||e.includes(`"`)&&e.includes(`'`)?`{${JSON.stringify(e)}}`:e.includes(`"`)?`'${e}'`:`"${e}"`:typeof e==`number`||typeof e==`boolean`?`{${e}}`:`{${JSON.stringify(e)}}`}function Vh(e){return e==null?`null`:typeof e==`string`?JSON.stringify(e):typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?`[${e.map(Vh).join(`,`)}]`:typeof e==`object`?Hh(e,!1):JSON.stringify(e)??`null`}function Hh(e,t){let n=Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>`${zh.test(e)?e:JSON.stringify(e)}:${Vh(t)}`);return t?`{ ${n.join(`,`)} }`:`{${n.join(`,`)}}`}function Uh(e,t,n){let r=Zh(e,t);if(r!==void 0)return`${t}={${r}}`;if(n===!0)return t;let i=Bh(n);return i?`${t}=${i}`:null}var Wh={"&":`&amp;`,'"':`&quot;`,"<":`&lt;`,">":`&gt;`,"\n":`&#xA;`,"\r":`&#xD;`,"`":`&#x60;`,"~":`&#x7E;`},Gh=e=>e.replace(/[&"<>\n\r`~]/g,e=>Wh[e]??e),Kh=Object.assign(Object.assign({},Wh),{"'":`&#x27;`,"*":`&#x2A;`,"{":`&#x7B;`,"}":`&#x7D;`}),qh=/&(?=#?[A-Za-z0-9]+;)|<(?=[A-Za-z/!?])|(?<=\/)\*|\*(?=\/)|[\n\r`~{}]/g;function Jh(e,t){if(typeof t!=`string`)return null;let n=t.includes(`"`)?`'`:`"`;return`${e}=${n}${t.replace(RegExp(`${qh.source}|${n}`,`g`),e=>Kh[e]??e)}${n}`}function Yh(e,t,n){return typeof n==`string`?`${t}="${Gh(n)}"`:Uh(e,t,n)}var Xh=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Zh(e,t){let n=e[tp];if(!Xh(n))return;let r=n[t];return typeof r==`string`?r:void 0}var Qh=/* @__PURE__ */ new Set([`\\`,"`",`*`,`{`,`}`,`<`,`$`]),$h=/* @__PURE__ */ new Set([`|`,`_`,`[`,`]`,`>`,`+`,`&`]),eg=RegExp(`[${[...Qh,...$h].map(e=>`\\${e}`).join(``)}]`),tg=/[\p{L}\p{N}]/u,ng=/^\[[ xX]\]/,rg=/\][([]/,ig=/\]:/,ag=/^&(?:#[0-9]{1,7}|#x[0-9a-f]{1,6}|[a-z][a-z0-9]{1,31});/i;function og(e){return e!==void 0&&tg.test(e)}var sg=class{constructor(e={}){this.chunks=[],this.chunkStarts=[],this.outLength=0,this.tail=``,this.trailingSpaces=0,this.topLevelLead=null,this.delim=``,this.closed=!1,this.inTable=!1,this.inHtmlTable=!1,this.inCodeSection=!1,this.keptBlankLines=/* @__PURE__ */ new Set,this.hasReferenceDefinitions=!1,this.indentSize=2,this.sourceMap=null,this.nodePath=[],this.options={tightLists:e.tightLists??!1,indentSize:e.indentSize??2,listIndentSize:e.listIndentSize??0,removeTrailingNewline:e.removeTrailingNewline??!0,hasReferenceDefinitions:e.hasReferenceDefinitions??!1,emphasisMarker:e.emphasisMarker??`_`},this.indentSize=this.options.indentSize,this.hasReferenceDefinitions=this.options.hasReferenceDefinitions}get out(){if(this.chunks.length>1){let e=this.chunks.join(``);this.chunks=[e],this.chunkStarts=[0]}return this.chunks[0]??``}set out(e){this.chunks=[],this.chunkStarts=[],this.outLength=0,this.tail=``,this.trailingSpaces=0,this.append(e)}get length(){return this.outLength}get trailingSpaceCount(){return this.trailingSpaces}sliceFrom(e){let t=0,n=this.chunkStarts.length-1;for(;t<n;){let r=t+n+1>>1;(this.chunkStarts[r]??0)<=e?t=r:n=r-1}let r=this.chunks[t];return r===void 0?``:r.slice(e-(this.chunkStarts[t]??0))+this.chunks.slice(t+1).join(``)}truncate(e){let t=e;for(;t>0&&this.chunks.length>0;){let e=this.chunks[this.chunks.length-1]??``;e.length<=t?(t-=e.length,this.chunks.pop(),this.chunkStarts.pop()):(this.chunks[this.chunks.length-1]=e.slice(0,e.length-t),t=0)}this.outLength-=e-t,this.tail=``,this.trailingSpaces=0;for(let e=this.chunks.length-1;e>=0&&this.tail.length<2;e--)this.tail=((this.chunks[e]??``)+this.tail).slice(-2);for(let e=this.chunks.length-1;e>=0;e--){let t=this.chunks[e]??``,n=t.length;for(;n>0&&t.charCodeAt(n-1)===32;)n--;if(this.trailingSpaces+=t.length-n,n>0)break}}append(e){if(e.length===0)return;this.chunkStarts.push(this.outLength),this.chunks.push(e),this.outLength+=e.length,this.tail=(this.tail+e).slice(-2);let t=e.length;for(;t>0&&e.charCodeAt(t-1)===32;)t--;this.trailingSpaces=t===0?this.trailingSpaces+e.length:e.length-t;let n=this.topLevelLead;if(n&&!n.content){let t=0;for(;t<e.length&&e.charCodeAt(t)===10;)t++;n.lead+=t,t<e.length&&(n.content=!0)}}beginBlock(e){return this.sourceMap?(this.nodePath.push(e),this.nodePath.length===1&&(this.topLevelLead={lead:0,content:!1}),this.outLength):0}endBlock(e){if(this.sourceMap){if(this.nodePath.length===1){let t=this.topLevelLead?.lead??0;this.topLevelLead=null,this.sourceMap.push({path:[...this.nodePath],start:e+t,end:this.outLength,kind:`block`})}this.nodePath.pop()}}recordTextSuffix(e,t,n,r){this.sourceMap&&!this.inTable&&this.sourceMap.push({path:[...this.nodePath,e],start:this.outLength-t,end:this.outLength,kind:`text`,pmStart:n,pmEnd:r})}takeTextSuffix(e){if(!this.sourceMap||e===0)return null;let t=this.sourceMap.at(-1);if(t?.kind!==`text`||t.end!==this.outLength||t.end-t.start<e||t.pmEnd-t.pmStart<e)return null;let n=Object.assign({path:[...t.path],kind:`text`,pmStart:t.pmEnd-e,pmEnd:t.pmEnd},t.offsetEncoding&&{offsetEncoding:t.offsetEncoding});return t.end-=e,t.pmEnd-=e,t.start===t.end&&this.sourceMap.pop(),n}recordTextRange(e,t,n){this.sourceMap&&!this.inTable&&this.sourceMap.push(Object.assign(Object.assign({},e),{start:t,end:n}))}withNodePath(e,t){if(!this.sourceMap)return t();this.nodePath.push(e);try{return t()}finally{this.nodePath.pop()}}recordLiteralTextRange(e,t,n,r=0){this.sourceMap&&!this.inTable&&this.sourceMap.push({path:[...this.nodePath,...e],start:t,end:n,kind:`text`,pmStart:r,pmEnd:r+n-t,offsetEncoding:`identity`})}importTextEntries(e,t,n){if(this.sourceMap)for(let r of e)r.kind===`text`&&this.sourceMap.push(Object.assign({path:[...this.nodePath,...t,...r.path],start:n(r.start),end:n(r.end),kind:`text`,pmStart:r.pmStart,pmEnd:r.pmEnd},r.offsetEncoding&&{offsetEncoding:r.offsetEncoding}))}write(e){this.closed&&=(this.append(`
35
+ `),addLines:n,removeLines:r}}function jm(e){if(!e)return[];let t=[],n=e.replace(/[{}[\]]/g,``).split(`,`);for(let e of n){let n=e.trim(),r=n.match(/^(\d+)-(\d+)$/);if(r){let e=parseInt(r[1]??`0`,10),n=parseInt(r[2]??`0`,10);for(let r=e;r<=n;r++)t.push(r)}else{let e=parseInt(n,10);isNaN(e)||t.push(e)}}return t}function Mm(e){if(e.length===0)return``;let t=[...new Set(e)].sort((e,t)=>e-t),n=[],r=t[0]??0,i=r;for(let e=1;e<t.length;e++){let a=t[e]??0;a===i+1||(n.push(r===i?String(r):`${r}-${i}`),r=a),i=a}return n.push(r===i?String(r):`${r}-${i}`),n.join(`,`)}function Nm(e){let t=/* @__PURE__ */ new Set([`html`,`xml`,`svg`,`mdx`,`md`,`markdown`]),n=/* @__PURE__ */ new Set([`python`,`ruby`,`bash`,`sh`,`shell`,`zsh`,`yaml`,`yml`,`toml`,`perl`,`r`,`elixir`,`dockerfile`,`makefile`,`cmake`]),r=/* @__PURE__ */ new Set([`sql`,`lua`,`haskell`,`elm`]),i=/* @__PURE__ */ new Set([`css`,`scss`,`sass`,`less`,`stylus`]);return t.has(e)?{open:`<!--`,close:`-->`}:n.has(e)?{open:`#`,close:``}:r.has(e)?{open:`--`,close:``}:i.has(e)?{open:`/*`,close:`*/`}:{open:`//`,close:``}}var Pm=/* @__PURE__ */ new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`ul`,`ol`]);function Fm(e){return e.type!==`text`||`value`in e&&typeof e.value==`string`&&e.value.trim()!==``}function Im(e){return e?Array.isArray(e)?e.filter(Boolean):[e]:[]}function Lm(e,t,n){return e.flatMap(e=>{if(e.type===`text`){let{text:t,marks:n}=Gn(e);return[Wn(t,n)]}if(e.type===`image`||e.type===`mdxJsxTextElement`&&e.name===`img`){let t=Ap(e);return t?[t]:[]}return Im(n(e,t))}).filter(Boolean)}function Rm(e,t,n){let r=e.findIndex(Fm);if(r===-1)return null;let i=e.length-1;for(;i>r&&!Fm(e[i]);)i--;return{type:`paragraph`,content:Lm(e.slice(r,i+1),t,n)}}function zm(e,t,n){if(e.some(e=>e.type===`mdxJsxTextElement`&&e.name!=null&&Pm.has(e.name))){let r=[],i=[],a=()=>{let e=Rm(i,t,n);e&&r.push(e),i=[]};for(let o of e){if(o.type===`mdxJsxTextElement`&&o.name!=null&&Pm.has(o.name)){if(a(),/^h[1-6]$/.test(o.name)){let e=parseInt(o.name[1]??`1`,10);r.push({type:`heading`,attrs:{level:e},content:Lm(o.children,t,n)});continue}if(o.name===`ul`||o.name===`ol`){let e=o.children.filter(e=>e.type===`mdxJsxTextElement`&&e.name===`li`).map(e=>({type:`listItem`,content:[{type:`paragraph`,content:Lm(e.children,t,n)}]}));e.length>0&&r.push({type:o.name===`ol`?`orderedList`:`bulletList`,attrs:o.name===`ol`?{start:op(o.attributes)}:{},content:e});continue}}i.push(o)}return a(),r}if(e.every(e=>e.type===`text`||e.type===`emphasis`||e.type===`strong`||e.type===`link`||e.type===`linkReference`||e.type===`inlineCode`||e.type===`delete`||e.type===`image`||e.type===`break`||e.type===`inlineMath`||e.type===`footnoteReference`||e.type===`mdxTextExpression`||e.type===`mdxJsxTextElement`)){let r=Rm(e,t,n);return r?[r]:[]}return e.flatMap(e=>Im(n(e,t)))}function Bm(e,t,n,r){let i=t.schema??bn;if(e.children.some(e=>e.type===`image`||e.type===`mdxJsxTextElement`&&e.name===`img`)){if(e.children.some(e=>e.type===`text`||e.type===`emphasis`||e.type===`strong`||e.type===`link`||e.type===`linkReference`||e.type===`inlineCode`||e.type===`delete`||e.type===`mdxJsxTextElement`&&e.name!==`img`)){let r=[];for(let i of e.children)if(i.type===`image`||i.type===`mdxJsxTextElement`&&i.name===`img`){let e=Ap(i);e&&r.push(e)}else{let e=n(i,t);Array.isArray(e)?r.push(...e):r.push(e)}return Vm(r,i)}let r=[];for(let i of e.children)if(i.type===`image`||i.type===`mdxJsxTextElement`&&i.name===`img`){let e=n(i,t);Array.isArray(e)?r.push(...e):r.push(e)}return r.length>0?r:[]}let a=r(e,t);return a.every(e=>qn(e,i))?{type:`paragraph`,content:a}:Vm(a,i)}function Vm(e,t){return Jn(kp(e),t).map(e=>e.type===`paragraph`?Hm(e):e).filter(e=>e.type!==`paragraph`||(e.content?.length??0)>0)}function Hm(e){let t=[...e.content??[]],n=t[0];n?.type===`text`&&n.text&&!n.marks?.some(e=>e.type===`code`)&&(t[0]=Object.assign(Object.assign({},n),{text:n.text.replace(/^\s+/,``)}));let r=t.length-1,i=t[r];return i?.type===`text`&&i.text&&!i.marks?.some(e=>e.type===`code`)&&(t[r]=Object.assign(Object.assign({},i),{text:i.text.replace(/\s+$/,``)})),Object.assign(Object.assign({},e),{content:t.filter(e=>e.type!==`text`||e.text!==``)})}function Um(e,t,n){let r=e.children,i=e.align||[],a=r[0]?.children.length??0;return{type:`table`,content:r.map((e,r)=>{let o=e.children.reduce((e,t,n)=>t.children.length>0?Math.max(e,n+1):e,a);return{type:`tableRow`,content:e.children.slice(0,o).map((e,a)=>{let o=zm(e.children,t,n),s=i[a];return{type:r===0?`tableHeader`:`tableCell`,attrs:{align:s??null},content:o.length>0?o:[{type:`paragraph`,content:[]}]}})}})}}function Wm(e,t){if(e.lang===`mermaid`&&!t.hasGroupParent){if(!e.value)return[];let t=e.meta||``,n=t.match(/placement=["']([^"']+)["']/),r=t.match(/actions=\{(true|false)\}/);return{type:O.mermaidBlock,attrs:{placement:n?.[1]||`bottom-right`,actions:r?r[1]===`true`:null},content:[{type:O.codeBlock,attrs:{language:`text`,__hasGroupParent:!0,__isMermaidChild:!0},content:[Wn(e.value)]}]}}let n=km(e.meta||``),r=e.lang===`nocopy`;r&&n.nocopy===void 0&&(n.nocopy=!0);let{cleanedCode:i,addLines:a,removeLines:o}=Am(e.value||``),s={};return a.length>0&&(s.add=a),o.length>0&&(s.remove=o),Object.assign({type:O.codeBlock,attrs:Object.assign(Object.assign(Object.assign({language:r?`text`:e.lang||null},n),s),{__isHidden:t.isHidden,__hasGroupParent:t.hasGroupParent})},i?{content:[Wn(i)]}:{})}function Gm(e,t=``,n){let r=n?.schema??bn,i=Un(e),a=/* @__PURE__ */ new Map;g(e,e=>{e.type===`definition`&&!a.has(e.identifier)&&a.set(e.identifier,e);let t=e.type===`mdxJsxTextElement`&&e.name===`Prompt`;e.type!==`list`&&e.type!==`mdxJsxFlowElement`&&!t&&delete e.position});let o=Km(e,{source:t,frontmatter:i,schema:r,definitions:a,databases:n?.databases===!0}),s=Jn(Array.isArray(o)?o:o.content??[],r),c={type:`doc`,content:s.length>0?s:[]};return{doc:He.fromJSON(r,c),frontmatter:i}}function Km(e,t){if(!e)return[];switch(e.type){case`root`:return{type:`doc`,content:Zm(e,t)};case`heading`:return{type:`heading`,attrs:{level:e.depth},content:Zm(e,t)};case`paragraph`:return Bm(e,t,Km,Zm);case`text`:return e.value?{type:`text`,text:e.value.replace(/\n/g,` `)}:[];case`blockquote`:{let n=Zm(e,t);return{type:`blockquote`,content:n.length?n:[{type:`paragraph`}]}}case`list`:{let n=e.ordered?{start:e.start??1}:{},r=e.children.map(e=>Km(e,t));return{type:e.ordered?`orderedList`:`bulletList`,attrs:n,content:r.flat()}}case`listItem`:{let n=Zm(e,t);return{type:`listItem`,attrs:{checked:e.checked??null},content:n[0]?.type===`paragraph`?n:[{type:`paragraph`,content:[]},...n]}}case`table`:return Um(e,t,Km);case`tableRow`:case`tableCell`:return[];case`thematicBreak`:return{type:`horizontalRule`};case`break`:return{type:`hardBreak`};case`image`:return{type:O.image,attrs:{imgAttributes:{src:e.url,alt:e.alt??void 0,title:e.title??void 0}}};case`code`:return Wm(e,t);case`emphasis`:case`strong`:case`link`:case`delete`:return qm(e.children,Kn(e),t);case`linkReference`:{let n=Jm(e,t);return n?qm(e.children,[n],t):{type:O.inlineUnknownTag,attrs:{mdxJsxNode:e}}}case`inlineCode`:{let{text:t,marks:n}=Gn(e);return Wn(t,n)}case`math`:return e.value?{type:O.blockMath,attrs:{expression:e.value}}:[];case`inlineMath`:return e.value?{type:O.inlineMath,attrs:{expression:e.value}}:[];case`yaml`:return[];case`mdxJsxTextElement`:{let n=Ym(e,[],t);if(n)return n;if(!e.name||!Rp.has(e.name)||zp(e.name,t.schema??bn))return wm(e,t,Zm);let r=Vp(Object.assign(Object.assign({},e),{type:`mdxJsxFlowElement`,children:e.children.length>0?[{type:`paragraph`,children:e.children}]:[]}),t,Km,Qm);return(Array.isArray(r)?r:[r]).length>0?r:wm(e,t,Zm)}case`mdxJsxFlowElement`:return Vp(e,t,Km,Qm);case`mdxjsEsm`:return{type:O.mdxJsEsm,attrs:{mdastNode:e}};case`mdxFlowExpression`:return{type:O.unknownTag,attrs:{mdxJsxNode:e,__isHidden:!0}};case`mdxTextExpression`:case`footnoteReference`:return{type:O.inlineUnknownTag,attrs:{mdxJsxNode:e}};case`definition`:return{type:O.unknownTag,attrs:{mdxJsxNode:e,__isHidden:!0}};default:return{type:O.unknownTag,attrs:{mdxJsxNode:e}}}}function qm(e,t,n){let r=[];for(let i of e)if(i.type===`text`)i.value&&r.push(Wn(i.value.replace(/\n/g,` `),t));else if(i.type===`break`)r.push({type:`hardBreak`});else if(i.type===`inlineCode`)r.push(Wn(i.value||``,[...t,{type:`code`}]));else if(i.type===`linkReference`){let e=Jm(i,n);if(e)r.push(...qm(i.children,[...t,e],n));else{let e=Km(i,n);r.push(...Array.isArray(e)?e:[e])}}else if(i.type===`emphasis`||i.type===`strong`||i.type===`link`||i.type===`delete`)r.push(...qm(i.children,[...t,...Kn(i)],n));else if(i.type===`mdxJsxTextElement`&&i.name===`Link`){let e=Ym(i,t,n);if(e)r.push(...e);else{let e=Km(i,n);r.push(...Array.isArray(e)?e:[e])}}else if(i.type===`mdxJsxTextElement`&&(i.name===`u`||i.name===`sub`||i.name===`sup`))r.push(...qm(i.children,[...t,...Kn(i)],n));else if(i.type===`mdxJsxTextElement`&&i.name===`kbd`){let{text:e}=Gn(i);e&&r.push(Wn(e,[...t,{type:`kbd`}]))}else if(i.type===`image`||i.type===`mdxJsxTextElement`&&i.name===`img`){let e=Ap(i);e&&r.push(t.length>0?Object.assign(Object.assign({},e),{marks:t}):e)}else{let e=Km(i,n),a=Array.isArray(e)?e:[e],o=i.type===`mdxTextExpression`&&t.length>0?a.map(e=>Object.assign(Object.assign({},e),{marks:t})):a;r.push(...o)}return r}function Jm(e,t){let n=t.definitions?.get(e.identifier);if(n)return{type:`link`,attrs:{href:n.url,title:n.title??void 0,referenceLabel:e.label??n.label??e.identifier}}}function Ym(e,t,n){let r=Xm(e,n);if(!r)return;let i=qm(e.children,[...t,r],n),a=n.schema??bn,o=i.every(e=>{if(!qn(e,a)||e.type!==`text`&&e.type!==O.inlineImage&&e.type!==O.inlineUnknownTag)return!1;let t=e.marks?.filter(e=>e.type===`link`)??[];return t.length===1&&t[0]?.attrs?.mdxLinkAttributes!==void 0});return i.length>0&&o?i:void 0}function Xm(e,t){if(e.name!==`Link`||e.attributes.some(e=>e.type===`mdxJsxExpressionAttribute`))return;let n=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===`href`);if(!n||typeof n.value!=`string`)return;let r=$(e.attributes),i=t.nextMdxLinkId??0;return t.nextMdxLinkId=i+1,{type:`link`,attrs:{href:n.value,title:typeof r.title==`string`?r.title:void 0,mdxLinkAttributes:r,mdxLinkId:i}}}function Zm(e,t){return kp(e.children.flatMap(e=>Km(e,t)).filter(Boolean))}function Qm(e,t){return Jn(kp(Up({children:e.children}).children.flatMap(e=>e.type===`mdxJsxFlowElement`?Vp(e,t,Km,Qm):Km(e,t)).filter(Boolean)),t.schema??bn)}function $m(e,t){return Gm($f(e,t),e,t)}var eh=i().use(b).use(f,[`yaml`,`toml`]).use(a).freeze(),th=/(<\/?(?:aside|details)\b[^>]*>|<summary\b[^>]*>[\s\S]*?<\/summary>)/i,nh=/^<summary\b[^>]*>([\s\S]*?)<\/summary>$/i,rh=/<(area|br|col|embed|hr|img|input|source|track|wbr)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*\/?>/gi,ih=/^<([a-z][\w-]*)\b[^>]*(?<!\/)>$/i,ah=/<\/?[a-z][^>]*>/gi,oh=/* @__PURE__ */ new Set([`paragraph`,`heading`,`tableCell`,`emphasis`,`strong`,`delete`,`link`,`linkReference`]),sh=e=>`open`in e||`close`in e||`summary`in e,ch=e=>(e?.type===`mdxJsxFlowElement`||e?.type===`mdxJsxTextElement`)&&e.name===`summary`,lh=({tag:e,title:t,children:n})=>({type:`mdxJsxFlowElement`,name:e===`aside`?`Callout`:`Accordion`,attributes:e===`details`?[{type:`mdxJsxAttribute`,name:`title`,value:t??``}]:[],children:n});function uh(e){let[t]=e;if(ch(t))return e.shift(),Gn(t).text.trim();if(t?.type!==`paragraph`||!ch(t.children[0]))return;let n=t.children.shift();return Gn(t).text.trim()||e.shift(),Gn(n).text.trim()}function dh(e){g(e,`mdxJsxFlowElement`,(e,t,n)=>{if(!n||t===void 0||e.name!==`aside`&&e.name!==`details`)return;let r=e.children,i=e.name===`details`?uh(r):void 0;n.children[t]=lh({tag:e.name,title:i,children:r})})}var fh=/^\s*\/\*[\s\S]*\*\/\s*$/;function ph(e){g(e,(e,t,n)=>{if(e.type!==`mdxTextExpression`&&e.type!==`mdxFlowExpression`||!n||t===void 0||fh.test(e.value))return;let r={type:`text`,value:`{${e.value}}`};n.children[t]=e.type===`mdxFlowExpression`?{type:`paragraph`,children:[r]}:r})}function mh(e){try{return $f(e.replace(rh,`<$1$2 />`)).children}catch{let t=e.replace(ah,``).trim();return t?[{type:`paragraph`,children:[{type:`text`,value:t}]}]:[]}}function hh(e){return mh(e).flatMap(e=>e.type===`paragraph`?e.children:e.type===`mdxJsxFlowElement`?[Object.assign(Object.assign({},e),{type:`mdxJsxTextElement`})]:[])}function gh(e){let t=e.split(th);return t.length===1?mh(e):t.flatMap((e,t)=>{if(t%2==0)return e.trim()?bh(e).children:[];let n=nh.exec(e);return n?[{summary:(n[1]??``).replace(ah,``).trim()}]:e.startsWith(`</`)?[{close:!0}]:[{open:/^<aside/i.test(e)?`aside`:`details`}]})}function _h(e){let t=[],n=[],r=()=>n.at(-1)?.children??t,i=()=>{let e=n.pop();e&&r().push(lh(e))};for(let a of e)if(!sh(a))r().push(a);else if(`open`in a)n.push({tag:a.open,children:[]});else if(`close`in a)i();else{let e=n.at(-1);e?e.title=a.summary:t.push({type:`paragraph`,children:[{type:`text`,value:a.summary}]})}for(;n.length>0;)i();return t}function vh(e,t,n){let r=e[t],i=r?.type===`html`?ih.exec(r.value)?.[1]:void 0,a=(r?.position)?.start.offset;if(!i||a===void 0)return;let o=e.findIndex((e,n)=>n>t&&e.type===`html`&&e.value.toLowerCase()===`</${i}>`.toLowerCase()),s=(e[o]?.position)?.end.offset;if(o!==-1&&s!==void 0)return{nodes:hh(n.slice(a,s)),skip:o-t}}function yh(e,t){let n=oh.has(e.type),r=[];for(let i=0;i<e.children.length;i++){let a=e.children[i];if(a.type!==`html`)`children`in a&&yh(a,t),r.push(a);else if(!n)r.push(...gh(a.value));else{let n=vh(e.children,i,t);r.push(...n?.nodes??hh(a.value)),i+=n?.skip??0}}e.children=r.some(sh)?_h(r):r}function bh(e){let t=eh.parse(e);return y(t,e),yh(t,e),t}function xh(e){try{let t=$f(e);return dh(t),ph(t),t}catch{return bh(e)}}function Sh(e,t){return Gm(xh(e),e,t)}function Ch(e){return e!==void 0&&e!==``}function wh(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>Ch(t)))}function Th(){let e=/* @__PURE__ */ new Set,t=/* @__PURE__ */ new Set,n=d.shape;for(let[r,i]of Object.entries(n)){let n=i instanceof te?i.unwrap():i;n instanceof ee&&e.add(r),n instanceof ne&&t.add(r),n instanceof S&&n.options.every(e=>e instanceof ne)&&t.add(r)}return{booleanKeys:e,arrayKeys:t}}var{booleanKeys:Eh,arrayKeys:Dh}=Th(),Oh=Array.from(Eh),kh=Array.from(Dh);function Ah(e){try{return JSON.parse(e)}catch{return e}}var jh=/* @__PURE__ */ new Set([`automerge`]);function Mh(e,t){if(Eh.has(e)||jh.has(e))return t===`true`;if(Dh.has(e)){let e=Ah(t);return Array.isArray(e)?e:t}return t}var Nh={lineWidth:-1,quotingType:`"`,forceQuotes:!0},Ph=/* @__PURE__ */ new Set([`background`,`eyebrow`]);function Fh(e,t){return Array.isArray(e)?e.map(e=>Fh(e)):typeof e==`object`&&e&&!(e instanceof Date)?Object.fromEntries(Object.entries(e).filter(([e,n])=>Ch(n)||n===``&&!!t?.has(e)).map(([e,t])=>[e,Fh(t)])):e}function Ih(e,t){let n=Eh.has(e),r=t;n&&(r===`true`||r===`false`)&&(r=r===`true`),r===void 0&&(r=null);let i=e===`thumbnail`?Ph:void 0;return u.dump({[e]:Fh(r,i)},Nh).trimEnd()}function Lh(e){if(!e||!e.startsWith(`<`)||!e.endsWith(`>`))return!1;try{let t=Hf(e).parseExpressionAt(e,0,{sourceType:`module`});return t.type===`JSXElement`&&t.end===e.length}catch{return!1}}function Rh(e){return e.textContent}var zh=/^[A-Za-z_$][\w$]*$/;function Bh(e){return e==null?null:typeof e==`object`?`{${Array.isArray(e)?Vh(e):Hh(e,!0)}}`:typeof e==`string`?e===``?`""`:Lh(e)?`{${e}}`:e.includes(`&`)||e.includes(`"`)&&e.includes(`'`)?`{${JSON.stringify(e)}}`:e.includes(`"`)?`'${e}'`:`"${e}"`:typeof e==`number`||typeof e==`boolean`?`{${e}}`:`{${JSON.stringify(e)}}`}function Vh(e){return e==null?`null`:typeof e==`string`?JSON.stringify(e):typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?`[${e.map(Vh).join(`,`)}]`:typeof e==`object`?Hh(e,!1):JSON.stringify(e)??`null`}function Hh(e,t){let n=Object.entries(e).filter(([,e])=>e!==void 0).map(([e,t])=>`${zh.test(e)?e:JSON.stringify(e)}:${Vh(t)}`);return t?`{ ${n.join(`,`)} }`:`{${n.join(`,`)}}`}function Uh(e,t,n){let r=Qh(e,t);if(r!==void 0)return`${t}={${r}}`;if(n===!0)return t;let i=Bh(n);return i?`${t}=${i}`:null}var Wh={"&":`&amp;`,'"':`&quot;`,"<":`&lt;`,">":`&gt;`,"\n":`&#xA;`,"\r":`&#xD;`,"`":`&#x60;`,"~":`&#x7E;`},Gh=e=>e.replace(/[&"<>\n\r`~]/g,e=>Wh[e]??e),Kh=e=>e.replace(/&(?=#?[A-Za-z0-9]+;)|["<>\n\r`~]/g,e=>Wh[e]??e),qh=Object.assign(Object.assign({},Wh),{"'":`&#x27;`,"*":`&#x2A;`,"{":`&#x7B;`,"}":`&#x7D;`}),Jh=/&(?=#?[A-Za-z0-9]+;)|<(?=[A-Za-z/!?])|(?<=\/)\*|\*(?=\/)|[\n\r`~{}]/g;function Yh(e,t){if(typeof t!=`string`)return null;let n=t.includes(`"`)?`'`:`"`;return`${e}=${n}${t.replace(RegExp(`${Jh.source}|${n}`,`g`),e=>qh[e]??e)}${n}`}function Xh(e,t,n){return typeof n==`string`?`${t}="${Gh(n)}"`:Uh(e,t,n)}var Zh=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Qh(e,t){let n=e[tp];if(!Zh(n))return;let r=n[t];return typeof r==`string`?r:void 0}var $h=/* @__PURE__ */ new Set([`\\`,"`",`*`,`{`,`}`,`<`,`$`]),eg=/* @__PURE__ */ new Set([`|`,`_`,`[`,`]`,`>`,`+`,`&`]),tg=RegExp(`[${[...$h,...eg].map(e=>`\\${e}`).join(``)}]`),ng=/[\p{L}\p{N}]/u,rg=/^\[[ xX]\]/,ig=/\][([]/,ag=/\]:/,og=/^&(?:#[0-9]{1,7}|#x[0-9a-f]{1,6}|[a-z][a-z0-9]{1,31});/i;function sg(e){return e!==void 0&&ng.test(e)}var cg=class{constructor(e={}){this.chunks=[],this.chunkStarts=[],this.outLength=0,this.tail=``,this.trailingSpaces=0,this.topLevelLead=null,this.delim=``,this.closed=!1,this.inTable=!1,this.inHtmlTable=!1,this.inCodeSection=!1,this.keptBlankLines=/* @__PURE__ */ new Set,this.hasReferenceDefinitions=!1,this.indentSize=2,this.sourceMap=null,this.nodePath=[],this.options={tightLists:e.tightLists??!1,indentSize:e.indentSize??2,listIndentSize:e.listIndentSize??0,removeTrailingNewline:e.removeTrailingNewline??!0,hasReferenceDefinitions:e.hasReferenceDefinitions??!1,emphasisMarker:e.emphasisMarker??`_`},this.indentSize=this.options.indentSize,this.hasReferenceDefinitions=this.options.hasReferenceDefinitions}get out(){if(this.chunks.length>1){let e=this.chunks.join(``);this.chunks=[e],this.chunkStarts=[0]}return this.chunks[0]??``}set out(e){this.chunks=[],this.chunkStarts=[],this.outLength=0,this.tail=``,this.trailingSpaces=0,this.append(e)}get length(){return this.outLength}get trailingSpaceCount(){return this.trailingSpaces}sliceFrom(e){let t=0,n=this.chunkStarts.length-1;for(;t<n;){let r=t+n+1>>1;(this.chunkStarts[r]??0)<=e?t=r:n=r-1}let r=this.chunks[t];return r===void 0?``:r.slice(e-(this.chunkStarts[t]??0))+this.chunks.slice(t+1).join(``)}truncate(e){let t=e;for(;t>0&&this.chunks.length>0;){let e=this.chunks[this.chunks.length-1]??``;e.length<=t?(t-=e.length,this.chunks.pop(),this.chunkStarts.pop()):(this.chunks[this.chunks.length-1]=e.slice(0,e.length-t),t=0)}this.outLength-=e-t,this.tail=``,this.trailingSpaces=0;for(let e=this.chunks.length-1;e>=0&&this.tail.length<2;e--)this.tail=((this.chunks[e]??``)+this.tail).slice(-2);for(let e=this.chunks.length-1;e>=0;e--){let t=this.chunks[e]??``,n=t.length;for(;n>0&&t.charCodeAt(n-1)===32;)n--;if(this.trailingSpaces+=t.length-n,n>0)break}}append(e){if(e.length===0)return;this.chunkStarts.push(this.outLength),this.chunks.push(e),this.outLength+=e.length,this.tail=(this.tail+e).slice(-2);let t=e.length;for(;t>0&&e.charCodeAt(t-1)===32;)t--;this.trailingSpaces=t===0?this.trailingSpaces+e.length:e.length-t;let n=this.topLevelLead;if(n&&!n.content){let t=0;for(;t<e.length&&e.charCodeAt(t)===10;)t++;n.lead+=t,t<e.length&&(n.content=!0)}}beginBlock(e){return this.sourceMap?(this.nodePath.push(e),this.nodePath.length===1&&(this.topLevelLead={lead:0,content:!1}),this.outLength):0}endBlock(e){if(this.sourceMap){if(this.nodePath.length===1){let t=this.topLevelLead?.lead??0;this.topLevelLead=null,this.sourceMap.push({path:[...this.nodePath],start:e+t,end:this.outLength,kind:`block`})}this.nodePath.pop()}}recordTextSuffix(e,t,n,r){this.sourceMap&&!this.inTable&&this.sourceMap.push({path:[...this.nodePath,e],start:this.outLength-t,end:this.outLength,kind:`text`,pmStart:n,pmEnd:r})}takeTextSuffix(e){if(!this.sourceMap||e===0)return null;let t=this.sourceMap.at(-1);if(t?.kind!==`text`||t.end!==this.outLength||t.end-t.start<e||t.pmEnd-t.pmStart<e)return null;let n=Object.assign({path:[...t.path],kind:`text`,pmStart:t.pmEnd-e,pmEnd:t.pmEnd},t.offsetEncoding&&{offsetEncoding:t.offsetEncoding});return t.end-=e,t.pmEnd-=e,t.start===t.end&&this.sourceMap.pop(),n}recordTextRange(e,t,n){this.sourceMap&&!this.inTable&&this.sourceMap.push(Object.assign(Object.assign({},e),{start:t,end:n}))}withNodePath(e,t){if(!this.sourceMap)return t();this.nodePath.push(e);try{return t()}finally{this.nodePath.pop()}}recordLiteralTextRange(e,t,n,r=0){this.sourceMap&&!this.inTable&&this.sourceMap.push({path:[...this.nodePath,...e],start:t,end:n,kind:`text`,pmStart:r,pmEnd:r+n-t,offsetEncoding:`identity`})}importTextEntries(e,t,n){if(this.sourceMap)for(let r of e)r.kind===`text`&&this.sourceMap.push(Object.assign({path:[...this.nodePath,...t,...r.path],start:n(r.start),end:n(r.end),kind:`text`,pmStart:r.pmStart,pmEnd:r.pmEnd},r.offsetEncoding&&{offsetEncoding:r.offsetEncoding}))}write(e){this.closed&&=(this.append(`
36
36
  `),!1),this.delim&&this.tail.endsWith(`
37
37
  `)&&e.length>0&&e[0]!==`
38
38
  `&&this.append(this.delim),this.append(e)}ensureNewLine(){this.tail.endsWith(`
@@ -43,30 +43,30 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
43
43
  `)?`
44
44
  `:`
45
45
 
46
- `)}closeBlock(){this.closed=!0}text(e,t=!0){t&&!this.inCodeSection&&!this.inTable&&(e=this.esc(e)),this.write(e)}get escapesPipes(){return this.inTable&&!this.inHtmlTable}escCodeText(e){return this.escapesPipes?e.replace(/\|/g,`\\|`):e}esc(e,t={}){return this.escRange(e,0,e.length,t)}escRange(e,t,n,r={}){let i=e.slice(t,n);if(!eg.test(i))return i;let a=``;for(let i=t;i<n;i++){let t=e[i];this.needsEscape(e,i,r)&&(a+=`\\`),a+=t}return a}needsEscape(e,t,{inLinkText:n=!1}){let r=e[t],i=e[t-1],a=e[t+1];if(Qh.has(r))return!0;switch(r){case`&`:return ag.test(e.slice(t));case`|`:return this.escapesPipes;case`_`:return!(og(i)&&og(a));case`[`:return n||this.hasReferenceDefinitions||a===`^`||t===0&&(ng.test(e)||ig.test(e))||rg.test(e.slice(t+1));case`]`:return n||this.hasReferenceDefinitions||a===`(`||a===`[`||a===`:`&&e[0]===`[`;case`>`:return t===0;case`+`:return t===0&&(a===void 0||a===` `||a===` `);default:return!1}}},cg=[`bold`,`italic`,`strike`];function lg(e){return cg.includes(e.type.name)}var ug=/* @__PURE__ */ new Set([`text`,O.inlineImage,O.inlineUnknownTag]),dg=e=>e.filter(e=>{let{open:t,close:n}=gg(e);return t.length>0||n.length>0});function fg(e,t,n){if(e.length<2)return e;let r=e.find(e=>e.type.name===`link`);if(!r)return e;let i=n;for(let e=n+1;e<t.childCount;e++){let n=t.child(e);if(!ug.has(n.type.name)||!n.marks.some(e=>e.eq(r)))break;i=e}let a=i+1<t.childCount?t.child(i+1):null,o=a&&ug.has(a.type.name)?a.marks:[],s=e.filter(e=>!e.eq(r));return s.some(e=>o.some(t=>t.eq(e)))?e:[r,...s]}function pg(e,t,n,r){let i=[],a=t=>{let n=/* @__PURE__ */ new Set;for(let e=0;e<i.length;e++){let r=i[e];r&&!t.some(e=>e.eq(r))&&n.add(e)}let r=[];for(let e of t)i.some(t=>t.eq(e))||r.push(e);if(n.size===0&&r.length===0)return;let a=i.findIndex(e=>e.type.name===`code`),o=r.length>0&&a!==-1&&!n.has(a),s;if(n.size>0||o){let t=i.length;for(let e of n)t=Math.min(t,e);o&&(t=Math.min(t,a));let r=``,c=null;if([...n].some(e=>{let t=i[e];return t!==void 0&&lg(t)})){let t=e.trailingSpaceCount;t>0&&(r=` `.repeat(t),c=e.takeTextSuffix(t),e.truncate(t))}for(let n=i.length-1;n>=t;n--){let t=i[n];t&&e.write(gg(t,e.options.emphasisMarker).close)}let l=[];for(let e=t;e<i.length;e++)if(!n.has(e)){let t=i[e];t&&l.push(t)}if(i=i.slice(0,t),r){let t=e.length;e.write(r),c&&e.recordTextRange(c,t,e.length)}for(let t of l)t.type.name===`code`?s=t:(e.write(gg(t,e.options.emphasisMarker).open),i.push(t))}for(let t of r)t.type.name===`code`?s=t:(e.write(gg(t,e.options.emphasisMarker).open),i.push(t));s&&(e.write(gg(s,e.options.emphasisMarker).open),i.push(s))};for(let o=0;o<t.childCount;o++){let s=t.child(o),c=s.type.name;if(c===`text`){let n=s.text||``;if(!n)continue;let r=n.length,c=0,l=dg(s.marks);if(l.some(e=>lg(e)&&!i.some(t=>t.eq(e)))){let t=n.match(/^( +)/);if(t&&(e.write(t[0]),e.recordTextSuffix(o,t[0].length,0,t[0].length),c=t[0].length,n=n.slice(t[0].length),!n))continue}a(fg(l,t,o));let u=i.some(e=>e.type.name===`code`)?e.escCodeText(n):e.esc(n,{inLinkText:i.some(e=>e.type.name===`link`)});e.write(u),e.recordTextSuffix(o,u.length,c,r)}else{if(c===O.inlineImage){a(fg(dg(s.marks),t,o)),r.renderInlineImage(e,s);continue}if(c===O.inlineUnknownTag){a(fg(dg(s.marks),t,o)),e.withNodePath(o,()=>r.renderUnknownTag(e,s));continue}a([]),c===`hardBreak`?e.write(`<br />`):c===O.icon?r.renderIcon(e,s):c===O.badge?r.renderBadge(e,s):c===O.tooltip?e.withNodePath(o,()=>r.renderTooltip(e,s)):c===O.inlineMath?s.attrs.expression&&e.write(`$$${s.attrs.expression}$$`):n(e,s,t,0)}}a([])}function mg(e,t){let n=t.text||``;if(!n)return;let r=dg(t.marks),i=``,a=``;for(let t of r){let{open:n,close:r}=gg(t,e.options.emphasisMarker);i+=n,a=r+a}if(r.length>0){let t=n,o=``,s=``;if(r.some(lg)){let r=t.match(/^( +)/);r&&(o=r[0],t=t.slice(o.length));let i=t.match(/( +)$/);if(i&&(s=i[0],t=t.slice(0,-s.length)),!t){e.text(n);return}}o&&e.write(o),e.write(i),e.write(r.some(e=>e.type.name===`code`)?e.escCodeText(t):e.esc(t,{inLinkText:r.some(e=>e.type.name===`link`)})),e.write(a),s&&e.write(s)}else e.text(n)}function hg(e){return e.replace(/\\(?=[\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]|$)/g,`\\\\`).replace(/[\[\]]/g,`\\$&`)}function gg(e,t=`_`){switch(e.type.name){case`bold`:return{open:`**`,close:`**`};case`italic`:return{open:t,close:t};case`strike`:return{open:`~~`,close:`~~`};case`code`:return{open:"`",close:"`"};case`link`:{let t=_g(e);if(t)return t;let n=e.attrs.referenceLabel;if(typeof n==`string`&&n)return{open:`[`,close:`][${hg(n)}]`};let r=e.attrs.href||``,i=e.attrs.title,a=i?` "${Gh(i)}"`:``;return{open:`[`,close:`](${Gh(r).replace(/[()]/g,`\\$&`)}${a})`}}case`underline`:return{open:`<u>`,close:`</u>`};case`subscript`:return{open:`<sub>`,close:`</sub>`};case`superscript`:return{open:`<sup>`,close:`</sup>`};case`kbd`:return{open:`<kbd>`,close:`</kbd>`};default:return{open:``,close:``}}}function _g(e){let t=e.attrs.mdxLinkAttributes,n=e.attrs.href;if(!vg(t)||typeof n!=`string`)return;let r=Object.assign(Object.assign({},t),{href:n});e.attrs.title===null||e.attrs.title===void 0?delete r.title:r.title=e.attrs.title;let i=Object.entries(r).filter(([e])=>e!==tp).map(([e,t])=>Uh(r,e,t)).filter(e=>e!==null).join(` `);return{open:`<Link${i?` ${i}`:``}>`,close:`</Link>`}}function vg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yg(e){let{imgAttributes:t}=e.attrs;return vg(t)?t:{}}function bg(e){let{lightSrc:t,darkSrc:n,width:r,align:i}=e.attrs,a=yg(e);if(t&&n)return{kind:`lightDarkPair`};let o=t||a.src;return o?typeof o!=`string`||a[Mt]===!0||Object.keys(a).some(e=>e!==`src`&&e!==`alt`&&e!==`title`)||r||i||!kg(Object.assign(Object.assign({},a),{src:o}))?{kind:`jsx`}:{kind:`markdown`,src:o}:{kind:`none`}}function xg(e){return bg(e).kind===`markdown`}function Sg(e,t){let n=yg(t),r=t.attrs.lightSrc,i=t.attrs.darkSrc,a=t.attrs.width,o=t.attrs.align,s=bg(t);if(s.kind===`lightDarkPair`){let t=n.className;Tg(e,Object.assign(Object.assign({},n),{src:r,className:Cg(t,o,`dark:hidden`)})),e.ensureNewLine(),Tg(e,Object.assign(Object.assign({},n),{src:i,className:Cg(wg(t),o,`hidden dark:block`)}))}else if(s.kind!==`none`){let t=r||n.src;if(s.kind===`jsx`){let r=Object.assign(Object.assign({},n),{src:t});o&&(r.className=Cg(r.className,o)),a&&a!==100&&(r.style=Object.assign(Object.assign({},typeof r.style==`object`?r.style:{}),{width:`${a}%`})),Tg(e,r)}else Eg(e,n,s.src)}e.closeBlock()}function Cg(e,t,n){let r=e?e.trim():``;if(t&&t in Pt){r=r.split(` `).filter(e=>!e.match(/mr-auto|ml-auto|mx-auto/)).join(` `);let e=Pt[t]??``;r=r?`${r} ${e}`:e}return n&&(r=r?`${r} ${n}`:n),r||void 0}function wg(e){if(e)return e.split(/\s+/).filter(e=>e!==`block`).join(` `).trim()||void 0}function Tg(e,t){e.write(`<img`),e.ensureNewLine();for(let[n,r]of Object.entries(t)){if(r==null||jt.has(n))continue;let i=Uh(t,n,r);i&&(e.write(` ${i}`),e.ensureNewLine())}e.write(`/>`)}function Eg(e,t,n){let r=e.esc(String(t.alt||``),{inLinkText:!0}),i=Gh(n).replace(/[()]/g,`\\$&`),a=t.title;typeof a==`string`&&a?e.write(`![${r}](${i} "${Gh(a)}")`):e.write(`![${r}](${i})`)}var Dg=/[\s<>\u0000-\u001F]/,Og=/[\r\n]/;function kg(e){let t=e.src;if(typeof t!=`string`||!t||Dg.test(t))return!1;let n=e.alt;if(typeof n==`string`&&Og.test(n))return!1;let r=e.title;return!(typeof r==`string`&&Og.test(r))}function Ag(e,t){return!e.marks.some(e=>e.type.name===`link`)||typeof t.src!=`string`||!t.src||!kg(t)?!1:Object.entries(t).every(([e,t])=>e===`src`||e===`alt`||e===`title`||t==null)}function jg(e,t){let n=t.attrs.imgAttributes??{};if(Ag(t,n))Eg(e,n,n.src);else{e.write(`<img`);for(let[t,r]of Object.entries(n)){if(r==null||jt.has(t))continue;let i=Uh(n,t,r);i&&e.write(` ${i}`)}e.write(` />`)}}function Mg(e,t){let n=t.attrs.videoAttributes??{},r=t.attrs.sources??[];if(e.write(`<video`),Ng(e,n),r.length===0&&n[Nt]===!0)e.write(`></video>`);else if(r.length===0)e.write(` />`);else{e.write(`>`),e.ensureNewLine();for(let t of r)e.write(` <source`),Ng(e,t),e.write(` />`),e.ensureNewLine();e.write(`</video>`)}e.closeBlock()}function Ng(e,t){for(let[n,r]of Object.entries(t)){if(r==null||jt.has(n))continue;let i=Uh(t,n,r);i&&e.write(` ${i}`)}}var Pg=(e,t)=>{let n=[0];for(let t=0;t<e.length;t++)e[t]===`
47
- `&&n.push(t+1);return r=>{let i=Math.min(Math.max(r,0),e.length),a=n.length-1;for(;a>0&&(n[a]??0)>i;)a--;let o=n[a]??0;return(t[a]??t.at(-1)??0)+i-o}};function Fg(e,t,n){for(let r=0;r<t.childCount;r++){let i=t.child(r),a=new sg(e.options);a.sourceMap=e.sourceMap?[]:null,n(a,i,t,r);let o=a.out.replace(/\n+$/,``),s=o.split(`
48
- `),c=[];for(let t=0;t<s.length;t++){let n=s[t]??``;e.write(n.length>0?`> `:`>`),c.push(e.length),e.write(n),e.ensureNewLine()}e.importTextEntries(a.sourceMap??[],[r],Pg(o,c)),r<t.childCount-1&&(e.write(`>`),e.ensureNewLine())}e.closeBlock()}function Ig(e,t,n,r){let i=typeof t.attrs.start==`number`?t.attrs.start:1,a=typeof t.attrs.tight==`boolean`?t.attrs.tight:e.options.tightLists;for(let o=0;o<t.childCount;o++){let s=t.child(o),c=s.attrs.checked,l=c==null?``:c?`[x] `:`[ ] `,u=(n?`${i+o}. `:`- `)+l,d=` `.repeat(Math.max(u.length,e.options.listIndentSize)),f=new sg(e.options);f.sourceMap=e.sourceMap?[]:null,r(f,s);let p=f.out,m=p.split(`
49
- `),h=[],g=0;for(let t=0;t<m.length;t++){let n=m[t]??``,r=!a||f.keptBlankLines.has(g);g+=n.length+1,t===0?(e.write(u),h.push(e.length),e.write(n)):n.length>0?(e.ensureNewLine(),e.write(d),h.push(e.length),e.write(n)):(r&&t<m.length-1&&(e.ensureBlankLine(),e.keptBlankLines.add(e.length-1)),h.push(e.length))}e.importTextEntries(f.sourceMap??[],[o],Pg(p,h)),e.ensureNewLine()}e.closeBlock()}function Lg(e,t,n,r){if(e.inTable=!0,t.childCount===0)e.inTable=!1;else if(!Rg(t))e.inHtmlTable=!0,Bg(e,t,n,r),e.inHtmlTable=!1,e.inTable=!1;else{for(let i=0;i<t.childCount;i++){let a=t.child(i);e.write(`|`);for(let t=0;t<a.childCount;t++){let i=a.child(t);e.write(` `);let o=Vg(i,e.options,n,r);e.write(o),e.write(` |`)}if(e.ensureNewLine(),i===0){e.write(`|`);for(let t=0;t<a.childCount;t++){let n=a.child(t).attrs.align,r=`---`;(n===`left`||n===`center`)&&(r=`:`+r.slice(1)),(n===`right`||n===`center`)&&(r=r.slice(0,-1)+`:`),e.write(` ${r} |`)}e.ensureNewLine()}}e.closeBlock(),e.inTable=!1}}function Rg(e){return zg(e).every(e=>e===null)}function zg(e){var t;let n=[];return(t=e.firstChild)==null||t.forEach(e=>{let t=e.attrs.colwidth,r=e.attrs.colspan??1;for(let e=0;e<r;e++){let r=t?.[e];n.push(typeof r==`number`&&r>0?r:null)}}),n}function Bg(e,t,n,r){let i=t=>{e.write(t),e.ensureNewLine()},a=(t,a)=>{i(`${a}<tr>`),t.forEach(t=>{let o=t.type.name===`tableHeader`?`th`:`td`,s=t.attrs.align,c=s&&s!==`left`?` style={{ textAlign: "${s}" }}`:``,l=Vg(t,e.options,n,r,!0);i(`${a} <${o}${c}>${l}</${o}>`)}),i(`${a}</tr>`)};i(`<table>`),i(` <colgroup>`);for(let e of zg(t))i(e===null?` <col />`:` <col width="${Math.round(e)}" />`);i(` </colgroup>`);let o=t.firstChild;if(o&&(i(` <thead>`),a(o,` `),i(` </thead>`)),t.childCount>1){i(` <tbody>`);for(let e=1;e<t.childCount;e++)a(t.child(e),` `);i(` </tbody>`)}i(`</table>`),e.closeBlock()}function Vg(e,t,n,r,i=!1){let a=[];return e.forEach(e=>{if(e.type.name===`paragraph`){let r=Hg(e,t,n,i);r&&a.push(r);return}if(e.type.name===`heading`){let r=Hg(e,t,n,i),o=e.attrs.level||1;r&&a.push(`<h${o}>${r}</h${o}>`);return}let o=Wg(e,t,n,r,i);o&&a.push(o)}),a.join(` `)}function Hg(e,t,n,r=!1){let i=new sg(t);return i.inTable=!0,i.inHtmlTable=r,n(i,e),i.out.replace(/\n/g,` `).trim()}function Ug(e,t,n,r=!1){let i=new sg(t);return i.inTable=!0,i.inHtmlTable=r,n(i,e,e,0),i.out.replace(/\n+/g,` `).replace(/\s+/g,` `).trim()}function Wg(e,t,n,r,i=!1){if(e.type.name===`image`||e.type.name===O.image)return Gg(e);if(e.type.name===O.frame){let a=[];if(e.forEach(e=>{let o=Wg(e,t,n,r,i);o&&a.push(o)}),a.length===0)return``;let o=Object.entries(e.attrs).filter(([e,t])=>!jt.has(e)&&t!=null).map(([t,n])=>Uh(e.attrs,t,n)).filter(Boolean).join(` `);return`${o?`<Frame ${o}>`:`<Frame>`} ${a.join(` `)} </Frame>`}if(e.type.name===`bulletList`||e.type.name===`orderedList`){let a=e.type.name===`orderedList`?`ol`:`ul`,o=[];e.forEach(e=>{let a=[];e.forEach(e=>{if(e.type.name===`paragraph`){let r=Hg(e,t,n,i);r&&a.push(r);return}if(e.type.name===`heading`){let r=Hg(e,t,n,i),o=e.attrs.level||1;r&&a.push(`<h${o}>${r}</h${o}>`);return}let o=Wg(e,t,n,r,i);o&&a.push(o)}),o.push(`<li>${a.join(` `)}</li>`)});let s=e.attrs.start;return`${a===`ol`&&typeof s==`number`&&s!==1?`<ol start="${s}">`:`<${a}>`}${o.join(``)}</${a}>`}return Ug(e,t,r,i)}function Gg(e){let t=e.attrs.imgAttributes??{},n=e.attrs.lightSrc,r=e.attrs.darkSrc,i=e.attrs.width,a=e.attrs.align,o=(e,n)=>{let r=Object.assign(Object.assign({},t),{src:e}),o=r.className;return(a||n)&&(r.className=Cg(o,a,n)),i&&i!==100&&(r.style=Object.assign(Object.assign({},typeof r.style==`object`?r.style:{}),{width:`${i}%`})),r};if(n&&r)return[Kg(o(r,`hidden dark:block`)),Kg(o(n,`dark:hidden`))].filter(Boolean).join(` `);let s=n||t.src;return s?Kg(o(s)):``}function Kg(e){let t=Object.entries(e).filter(([e,t])=>t!=null&&!jt.has(e)).map(([t,n])=>Uh(e,t,n)).filter(Boolean);return t.length>0?`<img ${t.join(` `)} />`:`<img />`}function qg(e,t,n,r){let i=r,a=0;for(let r of n.split(`
50
- `))e.recordLiteralTextRange(t,i,i+r.length,a),i+=r.length+1+e.delim.length,a+=r.length+1}function Jg(e,t,n){e.inCodeSection=!0;let r=Rh(t),i=t.attrs.language||`text`,a=t.attrs.add,o=t.attrs.remove,s=Array.isArray(a)?a:typeof a==`string`&&a?jm(a):[],c=Array.isArray(o)?o:typeof o==`string`&&o?jm(o):[];if(s.length>0||c.length>0){let{open:e,close:t}=Nm(i),n=t?` ${t}`:``;r=r.split(`
46
+ `)}closeBlock(){this.closed=!0}text(e,t=!0){t&&!this.inCodeSection&&!this.inTable&&(e=this.esc(e)),this.write(e)}get escapesPipes(){return this.inTable&&!this.inHtmlTable}escCodeText(e){return this.escapesPipes?e.replace(/\|/g,`\\|`):e}esc(e,t={}){return this.escRange(e,0,e.length,t)}escRange(e,t,n,r={}){let i=e.slice(t,n);if(!tg.test(i))return i;let a=``;for(let i=t;i<n;i++){let t=e[i];this.needsEscape(e,i,r)&&(a+=`\\`),a+=t}return a}needsEscape(e,t,{inLinkText:n=!1}){let r=e[t],i=e[t-1],a=e[t+1];if($h.has(r))return!0;switch(r){case`&`:return og.test(e.slice(t));case`|`:return this.escapesPipes;case`_`:return!(sg(i)&&sg(a));case`[`:return n||this.hasReferenceDefinitions||a===`^`||t===0&&(rg.test(e)||ag.test(e))||ig.test(e.slice(t+1));case`]`:return n||this.hasReferenceDefinitions||a===`(`||a===`[`||a===`:`&&e[0]===`[`;case`>`:return t===0;case`+`:return t===0&&(a===void 0||a===` `||a===` `);default:return!1}}},lg=[`bold`,`italic`,`strike`];function ug(e){return lg.includes(e.type.name)}var dg=/* @__PURE__ */ new Set([`text`,O.inlineImage,O.inlineUnknownTag]),fg=e=>e.filter(e=>{let{open:t,close:n}=_g(e);return t.length>0||n.length>0});function pg(e,t,n){if(e.length<2)return e;let r=e.find(e=>e.type.name===`link`);if(!r)return e;let i=n;for(let e=n+1;e<t.childCount;e++){let n=t.child(e);if(!dg.has(n.type.name)||!n.marks.some(e=>e.eq(r)))break;i=e}let a=i+1<t.childCount?t.child(i+1):null,o=a&&dg.has(a.type.name)?a.marks:[],s=e.filter(e=>!e.eq(r));return s.some(e=>o.some(t=>t.eq(e)))?e:[r,...s]}function mg(e,t,n,r){let i=[],a=t=>{let n=/* @__PURE__ */ new Set;for(let e=0;e<i.length;e++){let r=i[e];r&&!t.some(e=>e.eq(r))&&n.add(e)}let r=[];for(let e of t)i.some(t=>t.eq(e))||r.push(e);if(n.size===0&&r.length===0)return;let a=i.findIndex(e=>e.type.name===`code`),o=r.length>0&&a!==-1&&!n.has(a),s;if(n.size>0||o){let t=i.length;for(let e of n)t=Math.min(t,e);o&&(t=Math.min(t,a));let r=``,c=null;if([...n].some(e=>{let t=i[e];return t!==void 0&&ug(t)})){let t=e.trailingSpaceCount;t>0&&(r=` `.repeat(t),c=e.takeTextSuffix(t),e.truncate(t))}for(let n=i.length-1;n>=t;n--){let t=i[n];t&&e.write(_g(t,e.options.emphasisMarker).close)}let l=[];for(let e=t;e<i.length;e++)if(!n.has(e)){let t=i[e];t&&l.push(t)}if(i=i.slice(0,t),r){let t=e.length;e.write(r),c&&e.recordTextRange(c,t,e.length)}for(let t of l)t.type.name===`code`?s=t:(e.write(_g(t,e.options.emphasisMarker).open),i.push(t))}for(let t of r)t.type.name===`code`?s=t:(e.write(_g(t,e.options.emphasisMarker).open),i.push(t));s&&(e.write(_g(s,e.options.emphasisMarker).open),i.push(s))};for(let o=0;o<t.childCount;o++){let s=t.child(o),c=s.type.name;if(c===`text`){let n=s.text||``;if(!n)continue;let r=n.length,c=0,l=fg(s.marks);if(l.some(e=>ug(e)&&!i.some(t=>t.eq(e)))){let t=n.match(/^( +)/);if(t&&(e.write(t[0]),e.recordTextSuffix(o,t[0].length,0,t[0].length),c=t[0].length,n=n.slice(t[0].length),!n))continue}a(pg(l,t,o));let u=i.some(e=>e.type.name===`code`)?e.escCodeText(n):e.esc(n,{inLinkText:i.some(e=>e.type.name===`link`)});e.write(u),e.recordTextSuffix(o,u.length,c,r)}else{if(c===O.inlineImage){a(pg(fg(s.marks),t,o)),r.renderInlineImage(e,s);continue}if(c===O.inlineUnknownTag){a(pg(fg(s.marks),t,o)),e.withNodePath(o,()=>r.renderUnknownTag(e,s));continue}a([]),c===`hardBreak`?e.write(`<br />`):c===O.icon?r.renderIcon(e,s):c===O.badge?r.renderBadge(e,s):c===O.tooltip?e.withNodePath(o,()=>r.renderTooltip(e,s)):c===O.inlineMath?s.attrs.expression&&e.write(`$$${s.attrs.expression}$$`):n(e,s,t,0)}}a([])}function hg(e,t){let n=t.text||``;if(!n)return;let r=fg(t.marks),i=``,a=``;for(let t of r){let{open:n,close:r}=_g(t,e.options.emphasisMarker);i+=n,a=r+a}if(r.length>0){let t=n,o=``,s=``;if(r.some(ug)){let r=t.match(/^( +)/);r&&(o=r[0],t=t.slice(o.length));let i=t.match(/( +)$/);if(i&&(s=i[0],t=t.slice(0,-s.length)),!t){e.text(n);return}}o&&e.write(o),e.write(i),e.write(r.some(e=>e.type.name===`code`)?e.escCodeText(t):e.esc(t,{inLinkText:r.some(e=>e.type.name===`link`)})),e.write(a),s&&e.write(s)}else e.text(n)}function gg(e){return e.replace(/\\(?=[\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]|$)/g,`\\\\`).replace(/[\[\]]/g,`\\$&`)}function _g(e,t=`_`){switch(e.type.name){case`bold`:return{open:`**`,close:`**`};case`italic`:return{open:t,close:t};case`strike`:return{open:`~~`,close:`~~`};case`code`:return{open:"`",close:"`"};case`link`:{let t=vg(e);if(t)return t;let n=e.attrs.referenceLabel;if(typeof n==`string`&&n)return{open:`[`,close:`][${gg(n)}]`};let r=e.attrs.href||``,i=e.attrs.title,a=i?` "${Kh(i)}"`:``;return{open:`[`,close:`](${Kh(r).replace(/[()]/g,`\\$&`)}${a})`}}case`underline`:return{open:`<u>`,close:`</u>`};case`subscript`:return{open:`<sub>`,close:`</sub>`};case`superscript`:return{open:`<sup>`,close:`</sup>`};case`kbd`:return{open:`<kbd>`,close:`</kbd>`};default:return{open:``,close:``}}}function vg(e){let t=e.attrs.mdxLinkAttributes,n=e.attrs.href;if(!yg(t)||typeof n!=`string`)return;let r=Object.assign(Object.assign({},t),{href:n});e.attrs.title===null||e.attrs.title===void 0?delete r.title:r.title=e.attrs.title;let i=Object.entries(r).filter(([e])=>e!==tp).map(([e,t])=>Uh(r,e,t)).filter(e=>e!==null).join(` `);return{open:`<Link${i?` ${i}`:``}>`,close:`</Link>`}}function yg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bg(e){let{imgAttributes:t}=e.attrs;return yg(t)?t:{}}function xg(e){let{lightSrc:t,darkSrc:n,width:r,align:i}=e.attrs,a=bg(e);if(t&&n)return{kind:`lightDarkPair`};let o=t||a.src;return o?typeof o!=`string`||a[Mt]===!0||Object.keys(a).some(e=>e!==`src`&&e!==`alt`&&e!==`title`)||r||i||!Ag(Object.assign(Object.assign({},a),{src:o}))?{kind:`jsx`}:{kind:`markdown`,src:o}:{kind:`none`}}function Sg(e){return xg(e).kind===`markdown`}function Cg(e,t){let n=bg(t),r=t.attrs.lightSrc,i=t.attrs.darkSrc,a=t.attrs.width,o=t.attrs.align,s=xg(t);if(s.kind===`lightDarkPair`){let t=n.className;Eg(e,Object.assign(Object.assign({},n),{src:r,className:wg(t,o,`dark:hidden`)})),e.ensureNewLine(),Eg(e,Object.assign(Object.assign({},n),{src:i,className:wg(Tg(t),o,`hidden dark:block`)}))}else if(s.kind!==`none`){let t=r||n.src;if(s.kind===`jsx`){let r=Object.assign(Object.assign({},n),{src:t});o&&(r.className=wg(r.className,o)),a&&a!==100&&(r.style=Object.assign(Object.assign({},typeof r.style==`object`?r.style:{}),{width:`${a}%`})),Eg(e,r)}else Dg(e,n,s.src)}e.closeBlock()}function wg(e,t,n){let r=e?e.trim():``;if(t&&t in Pt){r=r.split(` `).filter(e=>!e.match(/mr-auto|ml-auto|mx-auto/)).join(` `);let e=Pt[t]??``;r=r?`${r} ${e}`:e}return n&&(r=r?`${r} ${n}`:n),r||void 0}function Tg(e){if(e)return e.split(/\s+/).filter(e=>e!==`block`).join(` `).trim()||void 0}function Eg(e,t){e.write(`<img`),e.ensureNewLine();for(let[n,r]of Object.entries(t)){if(r==null||jt.has(n))continue;let i=Uh(t,n,r);i&&(e.write(` ${i}`),e.ensureNewLine())}e.write(`/>`)}function Dg(e,t,n){let r=e.esc(String(t.alt||``),{inLinkText:!0}),i=Kh(n).replace(/[()]/g,`\\$&`),a=t.title;typeof a==`string`&&a?e.write(`![${r}](${i} "${Kh(a)}")`):e.write(`![${r}](${i})`)}var Og=/[\s<>\u0000-\u001F]/,kg=/[\r\n]/;function Ag(e){let t=e.src;if(typeof t!=`string`||!t||Og.test(t))return!1;let n=e.alt;if(typeof n==`string`&&kg.test(n))return!1;let r=e.title;return!(typeof r==`string`&&kg.test(r))}function jg(e,t){return!e.marks.some(e=>e.type.name===`link`)||typeof t.src!=`string`||!t.src||!Ag(t)?!1:Object.entries(t).every(([e,t])=>e===`src`||e===`alt`||e===`title`||t==null)}function Mg(e,t){let n=t.attrs.imgAttributes??{};if(jg(t,n))Dg(e,n,n.src);else{e.write(`<img`);for(let[t,r]of Object.entries(n)){if(r==null||jt.has(t))continue;let i=Uh(n,t,r);i&&e.write(` ${i}`)}e.write(` />`)}}function Ng(e,t){let n=t.attrs.videoAttributes??{},r=t.attrs.sources??[];if(e.write(`<video`),Pg(e,n),r.length===0&&n[Nt]===!0)e.write(`></video>`);else if(r.length===0)e.write(` />`);else{e.write(`>`),e.ensureNewLine();for(let t of r)e.write(` <source`),Pg(e,t),e.write(` />`),e.ensureNewLine();e.write(`</video>`)}e.closeBlock()}function Pg(e,t){for(let[n,r]of Object.entries(t)){if(r==null||jt.has(n))continue;let i=Uh(t,n,r);i&&e.write(` ${i}`)}}var Fg=(e,t)=>{let n=[0];for(let t=0;t<e.length;t++)e[t]===`
47
+ `&&n.push(t+1);return r=>{let i=Math.min(Math.max(r,0),e.length),a=n.length-1;for(;a>0&&(n[a]??0)>i;)a--;let o=n[a]??0;return(t[a]??t.at(-1)??0)+i-o}};function Ig(e,t,n){for(let r=0;r<t.childCount;r++){let i=t.child(r),a=new cg(e.options);a.sourceMap=e.sourceMap?[]:null,n(a,i,t,r);let o=a.out.replace(/\n+$/,``),s=o.split(`
48
+ `),c=[];for(let t=0;t<s.length;t++){let n=s[t]??``;e.write(n.length>0?`> `:`>`),c.push(e.length),e.write(n),e.ensureNewLine()}e.importTextEntries(a.sourceMap??[],[r],Fg(o,c)),r<t.childCount-1&&(e.write(`>`),e.ensureNewLine())}e.closeBlock()}function Lg(e,t,n,r){let i=typeof t.attrs.start==`number`?t.attrs.start:1,a=typeof t.attrs.tight==`boolean`?t.attrs.tight:e.options.tightLists;for(let o=0;o<t.childCount;o++){let s=t.child(o),c=s.attrs.checked,l=c==null?``:c?`[x] `:`[ ] `,u=(n?`${i+o}. `:`- `)+l,d=` `.repeat(Math.max(u.length,e.options.listIndentSize)),f=new cg(e.options);f.sourceMap=e.sourceMap?[]:null,r(f,s);let p=f.out,m=p.split(`
49
+ `),h=[],g=0;for(let t=0;t<m.length;t++){let n=m[t]??``,r=!a||f.keptBlankLines.has(g);g+=n.length+1,t===0?(e.write(u),h.push(e.length),e.write(n)):n.length>0?(e.ensureNewLine(),e.write(d),h.push(e.length),e.write(n)):(r&&t<m.length-1&&(e.ensureBlankLine(),e.keptBlankLines.add(e.length-1)),h.push(e.length))}e.importTextEntries(f.sourceMap??[],[o],Fg(p,h)),e.ensureNewLine()}e.closeBlock()}function Rg(e,t,n,r){if(e.inTable=!0,t.childCount===0)e.inTable=!1;else if(!zg(t))e.inHtmlTable=!0,Vg(e,t,n,r),e.inHtmlTable=!1,e.inTable=!1;else{for(let i=0;i<t.childCount;i++){let a=t.child(i);e.write(`|`);for(let t=0;t<a.childCount;t++){let i=a.child(t);e.write(` `);let o=Hg(i,e.options,n,r);e.write(o),e.write(` |`)}if(e.ensureNewLine(),i===0){e.write(`|`);for(let t=0;t<a.childCount;t++){let n=a.child(t).attrs.align,r=`---`;(n===`left`||n===`center`)&&(r=`:`+r.slice(1)),(n===`right`||n===`center`)&&(r=r.slice(0,-1)+`:`),e.write(` ${r} |`)}e.ensureNewLine()}}e.closeBlock(),e.inTable=!1}}function zg(e){return Bg(e).every(e=>e===null)}function Bg(e){var t;let n=[];return(t=e.firstChild)==null||t.forEach(e=>{let t=e.attrs.colwidth,r=e.attrs.colspan??1;for(let e=0;e<r;e++){let r=t?.[e];n.push(typeof r==`number`&&r>0?r:null)}}),n}function Vg(e,t,n,r){let i=t=>{e.write(t),e.ensureNewLine()},a=(t,a)=>{i(`${a}<tr>`),t.forEach(t=>{let o=t.type.name===`tableHeader`?`th`:`td`,s=t.attrs.align,c=s&&s!==`left`?` style={{ textAlign: "${s}" }}`:``,l=Hg(t,e.options,n,r,!0);i(`${a} <${o}${c}>${l}</${o}>`)}),i(`${a}</tr>`)};i(`<table>`),i(` <colgroup>`);for(let e of Bg(t))i(e===null?` <col />`:` <col width="${Math.round(e)}" />`);i(` </colgroup>`);let o=t.firstChild;if(o&&(i(` <thead>`),a(o,` `),i(` </thead>`)),t.childCount>1){i(` <tbody>`);for(let e=1;e<t.childCount;e++)a(t.child(e),` `);i(` </tbody>`)}i(`</table>`),e.closeBlock()}function Hg(e,t,n,r,i=!1){let a=[];return e.forEach(e=>{if(e.type.name===`paragraph`){let r=Ug(e,t,n,i);r&&a.push(r);return}if(e.type.name===`heading`){let r=Ug(e,t,n,i),o=e.attrs.level||1;r&&a.push(`<h${o}>${r}</h${o}>`);return}let o=Gg(e,t,n,r,i);o&&a.push(o)}),a.join(` `)}function Ug(e,t,n,r=!1){let i=new cg(t);return i.inTable=!0,i.inHtmlTable=r,n(i,e),i.out.replace(/\n/g,` `).trim()}function Wg(e,t,n,r=!1){let i=new cg(t);return i.inTable=!0,i.inHtmlTable=r,n(i,e,e,0),i.out.replace(/\n+/g,` `).replace(/\s+/g,` `).trim()}function Gg(e,t,n,r,i=!1){if(e.type.name===`image`||e.type.name===O.image)return Kg(e);if(e.type.name===O.frame){let a=[];if(e.forEach(e=>{let o=Gg(e,t,n,r,i);o&&a.push(o)}),a.length===0)return``;let o=Object.entries(e.attrs).filter(([e,t])=>!jt.has(e)&&t!=null).map(([t,n])=>Uh(e.attrs,t,n)).filter(Boolean).join(` `);return`${o?`<Frame ${o}>`:`<Frame>`} ${a.join(` `)} </Frame>`}if(e.type.name===`bulletList`||e.type.name===`orderedList`){let a=e.type.name===`orderedList`?`ol`:`ul`,o=[];e.forEach(e=>{let a=[];e.forEach(e=>{if(e.type.name===`paragraph`){let r=Ug(e,t,n,i);r&&a.push(r);return}if(e.type.name===`heading`){let r=Ug(e,t,n,i),o=e.attrs.level||1;r&&a.push(`<h${o}>${r}</h${o}>`);return}let o=Gg(e,t,n,r,i);o&&a.push(o)}),o.push(`<li>${a.join(` `)}</li>`)});let s=e.attrs.start;return`${a===`ol`&&typeof s==`number`&&s!==1?`<ol start="${s}">`:`<${a}>`}${o.join(``)}</${a}>`}return Wg(e,t,r,i)}function Kg(e){let t=e.attrs.imgAttributes??{},n=e.attrs.lightSrc,r=e.attrs.darkSrc,i=e.attrs.width,a=e.attrs.align,o=(e,n)=>{let r=Object.assign(Object.assign({},t),{src:e}),o=r.className;return(a||n)&&(r.className=wg(o,a,n)),i&&i!==100&&(r.style=Object.assign(Object.assign({},typeof r.style==`object`?r.style:{}),{width:`${i}%`})),r};if(n&&r)return[qg(o(r,`hidden dark:block`)),qg(o(n,`dark:hidden`))].filter(Boolean).join(` `);let s=n||t.src;return s?qg(o(s)):``}function qg(e){let t=Object.entries(e).filter(([e,t])=>t!=null&&!jt.has(e)).map(([t,n])=>Uh(e,t,n)).filter(Boolean);return t.length>0?`<img ${t.join(` `)} />`:`<img />`}function Jg(e,t,n,r){let i=r,a=0;for(let r of n.split(`
50
+ `))e.recordLiteralTextRange(t,i,i+r.length,a),i+=r.length+1+e.delim.length,a+=r.length+1}function Yg(e,t,n){e.inCodeSection=!0;let r=Rh(t),i=t.attrs.language||`text`,a=t.attrs.add,o=t.attrs.remove,s=Array.isArray(a)?a:typeof a==`string`&&a?jm(a):[],c=Array.isArray(o)?o:typeof o==`string`&&o?jm(o):[];if(s.length>0||c.length>0){let{open:e,close:t}=Nm(i),n=t?` ${t}`:``;r=r.split(`
51
51
  `).map((t,r)=>{let i=r+1;return s.includes(i)?`${t} ${e} [!code ++]${n}`:c.includes(i)?`${t} ${e} [!code --]${n}`:t}).join(`
52
52
  `)}let l=r.match(/`{3,}/g),u=l?Math.max(...l.map(e=>e.length))+1:3,d="`".repeat(u),f=``;if(t.attrs.filename){let e=String(t.attrs.filename);f=t.attrs.filenameSyntax===`title`?` title="${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`:` `+e}if(t.attrs.expandable&&(f+=` expandable`),t.attrs.highlight){let e=Mm(Array.isArray(t.attrs.highlight)?t.attrs.highlight:jm(String(t.attrs.highlight)));e&&(f+=` highlight={${e}}`)}if(t.attrs.icon&&(f+=` icon=${t.attrs.icon}`),t.attrs.lines&&(f+=` lines`),t.attrs.wrap&&(f+=` wrap`),t.attrs.focus){let e=Mm(Array.isArray(t.attrs.focus)?t.attrs.focus:jm(String(t.attrs.focus)));e&&(f+=` focus={${e}}`)}t.attrs.twoslash&&(f+=` twoslash`),t.attrs.nocopy&&(f+=` nocopy`),e.write(d+i+f+`
53
53
  `);let p=e.delim?r.replace(/\n/g,`
54
54
  `+e.delim):r;e.write(p);let m=r.endsWith(`
55
- `);n&&t.childCount===1&&s.length===0&&c.length===0&&!m&&qg(e,n,r,e.length-p.length),e.ensureNewLine(),e.write(d),e.closeBlock(),e.inCodeSection=!1}var Yg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Xg=/[\\`*_[\]~&]/g;function Zg(e){for(let t=0;t<e.childCount;t+=1)if(e.child(t).marks.length>0)return!0;return!1}var Qg=hn(Qt),$g=hn($t);function e_(e,t,n){let r=t.attrs,{type:i}=r,a=Yg(r,[`type`]);r_(e,t,wt.find(e=>e===i)??`Callout`,a,n)}function t_(e,t,n,r,i,a=[]){let o=t.childCount>0?t.child(0):null,s=``;if(o){if(Zg(o)){let t=new sg(e.options);i(t,o),s=t.out}else{let e=Rh(o),t=e.replace(Xg,`\\$&`);s=t===e||he(e)===e?e:t}}let c=Lh(s)?s.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`):s,l=Object.assign(c?{title:c}:{},t.attrs),u=e.length;r_(e,t,n,l,r,a);let d=o?.firstChild;if(!d?.isText||d.text!==s)return;let f=e.sliceFrom(u),p=f.indexOf(`<${n}`),m=f.indexOf(`
56
- `,p),h=f.indexOf(`title=`,p),g=f.indexOf(s,h+6);p<0||m<0||h<0||g<0||h>=m||g+s.length>m||e.recordLiteralTextRange([0,0],u+g,u+g+s.length)}function n_(e,t,n,r,i=[]){r_(e,t,n,t.attrs,r,i)}function r_(e,t,n,r,i,a=[]){let o=z_(r),s=Object.entries(o).map(([e,t])=>jt.has(e)||a.includes(e)?null:Uh(o,e,t)).filter(Boolean),c=R_(o),l=[...s,...c].join(` `);e.write(`<${n}${l?` ${l}`:``}>`),e.ensureNewLine();let u=e.delim;e.delim+=` `.repeat(e.indentSize),i(e,t),e.delim=u,e.closed=!1,e.ensureNewLine(),e.write(`</${n}>`)}function i_(e,t,n){e.write(`<${n}${B_(t.attrs)}>
55
+ `);n&&t.childCount===1&&s.length===0&&c.length===0&&!m&&Jg(e,n,r,e.length-p.length),e.ensureNewLine(),e.write(d),e.closeBlock(),e.inCodeSection=!1}var Xg=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Zg=/[\\`*_[\]~&]/g;function Qg(e){for(let t=0;t<e.childCount;t+=1)if(e.child(t).marks.length>0)return!0;return!1}var $g=hn(Qt),e_=hn($t);function t_(e,t,n){let r=t.attrs,{type:i}=r,a=Xg(r,[`type`]);i_(e,t,wt.find(e=>e===i)??`Callout`,a,n)}function n_(e,t,n,r,i,a=[]){let o=t.childCount>0?t.child(0):null,s=``;if(o){if(Qg(o)){let t=new cg(e.options);i(t,o),s=t.out}else{let e=Rh(o),t=e.replace(Zg,`\\$&`);s=t===e||he(e)===e?e:t}}let c=Lh(s)?s.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`):s,l=Object.assign(c?{title:c}:{},t.attrs),u=e.length;i_(e,t,n,l,r,a);let d=o?.firstChild;if(!d?.isText||d.text!==s)return;let f=e.sliceFrom(u),p=f.indexOf(`<${n}`),m=f.indexOf(`
56
+ `,p),h=f.indexOf(`title=`,p),g=f.indexOf(s,h+6);p<0||m<0||h<0||g<0||h>=m||g+s.length>m||e.recordLiteralTextRange([0,0],u+g,u+g+s.length)}function r_(e,t,n,r,i=[]){i_(e,t,n,t.attrs,r,i)}function i_(e,t,n,r,i,a=[]){let o=B_(r),s=Object.entries(o).map(([e,t])=>jt.has(e)||a.includes(e)?null:Uh(o,e,t)).filter(Boolean),c=z_(o),l=[...s,...c].join(` `);e.write(`<${n}${l?` ${l}`:``}>`),e.ensureNewLine();let u=e.delim;e.delim+=` `.repeat(e.indentSize),i(e,t),e.delim=u,e.closed=!1,e.ensureNewLine(),e.write(`</${n}>`)}function a_(e,t,n){e.write(`<${n}${V_(t.attrs)}>
57
57
 
58
- `);for(let n=0;n<t.childCount;n++){let r=t.child(n);r.type.name===O.codeBlock&&(Jg(e,r,[n,0]),n<t.childCount-1&&e.ensureNewLine())}e.ensureNewLine(),e.write(`</${n}>`),e.closeBlock()}function a_(e,t,n){let r=t.attrs.name||`CustomComponent`;r===`CodeBlock`?Jg(e,t):r_(e,t,r,t.attrs.attributes??{},n)}function o_(e,t){let n=z_(t.attrs),r=Object.assign({},n);r.icon===!0&&delete r.icon;let i=Object.entries(r).map(([e,t])=>!t||jt.has(e)?null:Uh(r,e,t)).filter(Boolean).join(` `);e.write(`<Icon ${i} />`)}function s_(e,t){let n=z_(t.attrs),r=Object.entries(n).filter(([e,t])=>jt.has(e)||t==null?!1:t!==Qg[e]).map(([e,t])=>Uh(n,e,t)).filter(Boolean).join(` `),i=Rh(t);i?e.write(`<${O.badge}${r?` ${r}`:``}>${e.esc(i)}</${O.badge}>`):e.write(`<${O.badge}${r?` ${r}`:``} />`)}function c_(e,t,n){let r=z_(t.attrs),i=Object.entries(r).filter(([e,t])=>jt.has(e)||e===`isNewlyCreated`||t==null||t===``?!1:t!==$g[e]).map(([e,t])=>Uh(r,e,t)).filter(Boolean).join(` `);t.childCount>0?(e.write(`<${O.tooltip}${i?` ${i}`:``}>`),n(e,t),e.write(`</${O.tooltip}>`)):e.write(`<${O.tooltip}${i?` ${i}`:``} />`)}var l_=/* @__PURE__ */ new WeakMap;function u_(e,t){try{let n;return $m(t,{schema:e.type.schema}).doc.descendants(e=>(n===void 0&&zn.has(e.type.name)&&(n=e.textContent),n===void 0)),n}catch{return}}function d_(e,t,n){return l_.has(t)||l_.set(t,u_(e,n)),l_.get(t)}function f_(e,t,n){if(e.childCount===0&&!e.inlineContent)return!1;let r=d_(e,t,n);return r!==void 0&&r!==e.textContent}function p_(e){return k_([Object.assign(Object.assign({},e),{children:[],data:void 0})]).trim().replace(/^<|\s*\/>$/g,``)}function m_(e,t,n,r){let i=e.inTable||t.type.name===O.inlineStaticHTML,a=t=>e.escapesPipes?t.replace(/\|/g,`&#124;`):t,o=e=>a(e.replace(/\s*\n\s*/g,` `).trim()),s=t.attrs.mdxJsxNode,c;if(s)try{let n=k_([s]);if(!f_(t,s,n)){i?e.write(o(n)):(e.write(n),e.closeBlock());return}s.name&&(c=p_(s),i&&(c=o(c)))}catch{}let l=t.attrs.tagName||`div`,u=t.attrs.attributes??{},d=Object.entries(u).filter(([e,t])=>t!=null).map(([e,t])=>jt.has(e)?null:Uh(u,e,t)).filter(Boolean),f=R_(u),p=[...d,...f].join(` `),m=c??(p?`${l} ${p}`:l);t.childCount>0?(e.write(`<${m}>`),i||e.ensureNewLine(),t.inlineContent?r(e,t):n(e,t),e.write(`</${c?s.name:l}>`)):e.write(`<${m} />`),i||e.closeBlock()}var h_=2,g_=2,__=(e,t)=>e.split(`
58
+ `);for(let n=0;n<t.childCount;n++){let r=t.child(n);r.type.name===O.codeBlock&&(Yg(e,r,[n,0]),n<t.childCount-1&&e.ensureNewLine())}e.ensureNewLine(),e.write(`</${n}>`),e.closeBlock()}function o_(e,t,n){let r=t.attrs.name||`CustomComponent`;r===`CodeBlock`?Yg(e,t):i_(e,t,r,t.attrs.attributes??{},n)}function s_(e,t){let n=B_(t.attrs),r=Object.assign({},n);r.icon===!0&&delete r.icon;let i=Object.entries(r).map(([e,t])=>!t||jt.has(e)?null:Uh(r,e,t)).filter(Boolean).join(` `);e.write(`<Icon ${i} />`)}function c_(e,t){let n=B_(t.attrs),r=Object.entries(n).filter(([e,t])=>jt.has(e)||t==null?!1:t!==$g[e]).map(([e,t])=>Uh(n,e,t)).filter(Boolean).join(` `),i=Rh(t);i?e.write(`<${O.badge}${r?` ${r}`:``}>${e.esc(i)}</${O.badge}>`):e.write(`<${O.badge}${r?` ${r}`:``} />`)}function l_(e,t,n){let r=B_(t.attrs),i=Object.entries(r).filter(([e,t])=>jt.has(e)||e===`isNewlyCreated`||t==null||t===``?!1:t!==e_[e]).map(([e,t])=>Uh(r,e,t)).filter(Boolean).join(` `);t.childCount>0?(e.write(`<${O.tooltip}${i?` ${i}`:``}>`),n(e,t),e.write(`</${O.tooltip}>`)):e.write(`<${O.tooltip}${i?` ${i}`:``} />`)}var u_=/* @__PURE__ */ new WeakMap;function d_(e,t){try{let n;return $m(t,{schema:e.type.schema}).doc.descendants(e=>(n===void 0&&zn.has(e.type.name)&&(n=e.textContent),n===void 0)),n}catch{return}}function f_(e,t,n){return u_.has(t)||u_.set(t,d_(e,n)),u_.get(t)}function p_(e,t,n){if(e.childCount===0&&!e.inlineContent)return!1;let r=f_(e,t,n);return r!==void 0&&r!==e.textContent}function m_(e){return A_([Object.assign(Object.assign({},e),{children:[],data:void 0})]).trim().replace(/^<|\s*\/>$/g,``)}function h_(e,t,n,r){let i=e.inTable||t.type.name===O.inlineStaticHTML,a=t=>e.escapesPipes?t.replace(/\|/g,`&#124;`):t,o=e=>a(e.replace(/\s*\n\s*/g,` `).trim()),s=t.attrs.mdxJsxNode,c;if(s)try{let n=A_([s]);if(!p_(t,s,n)){i?e.write(o(n)):(e.write(n),e.closeBlock());return}s.name&&(c=m_(s),i&&(c=o(c)))}catch{}let l=t.attrs.tagName||`div`,u=t.attrs.attributes??{},d=Object.entries(u).filter(([e,t])=>t!=null).map(([e,t])=>jt.has(e)?null:Uh(u,e,t)).filter(Boolean),f=z_(u),p=[...d,...f].join(` `),m=c??(p?`${l} ${p}`:l);t.childCount>0?(e.write(`<${m}>`),i||e.ensureNewLine(),t.inlineContent?r(e,t):n(e,t),e.write(`</${c?s.name:l}>`)):e.write(`<${m} />`),i||e.closeBlock()}var g_=2,__=2,v_=(e,t)=>e.split(`
59
59
  `).map((e,n)=>{if(n===0||e===``)return e;if(t>=0)return`${` `.repeat(t)}${e}`;let r=Math.min(-t,e.match(/^ */)?.[0].length??0);return e.slice(r)}).join(`
60
- `),v_=(e,t)=>{if(e.type===`mdxFlowExpression`){e.value=__(e.value,h_-g_*t);return}if(!(`children`in e))return;let n=e.type===`mdxJsxFlowElement`?t+1:t;for(let t of e.children)v_(t,n)},y_=e=>typeof e==`object`&&!!e&&(e.type===`mdxFlowExpression`||e.type===`mdxTextExpression`)&&typeof e.value==`string`;function b_(e,t){let n=t.attrs.mdxJsxNode;if(y_(n))e.write(`{${__(n.value,h_)}}`),t.type.name===O.unknownTag&&e.closeBlock();else{if(n)try{let r=k_([n]),i=t.type.name===O.inlineUnknownTag?r.replace(/\n$/,``):r;e.write(i)}catch{e.write(`<!-- unknown tag -->`)}t.type.name===O.unknownTag&&e.closeBlock()}}function x_(e,t){let n=t.attrs.mdastNode;if(n)try{let t=k_([n]);e.write(t)}catch{e.write(`<!-- esm node -->`)}e.closeBlock()}var S_=/[\p{L}\p{N}]/u;function C_(e){return e.replace(/\\_/g,(t,n)=>{let r=e[n-1],i=e[n+2];return r!==void 0&&S_.test(r)&&i!==void 0&&S_.test(i)?`_`:t})}var w_=e=>{for(let t of e){let e=t.handlers?.mdxJsxFlowElement??w_(t.extensions??[]);if(e)return e}},T_=e=>p(e)&&e.name!==null&&e.children.length===0&&e.data?.closingTag===!0,E_=e=>(t,n,r,i)=>{let a=e(t,n,r,i);return T_(t)?a.replace(/ ?\/>$/,`></${t.name}>`):a},D_=w_(o().use(x).freeze().data(`toMarkdownExtensions`)??[]),O_=Object.assign({text:(e,t,n,r)=>C_(n.safe(e.value,r)),inlineMath:e=>`$$${e.value}$$`},D_&&{mdxJsxFlowElement:E_(D_),mdxJsxTextElement:E_(D_)});function k_(e){let t=structuredClone(e).map(e=>e?.type===`mdxJsxTextElement`?{type:`paragraph`,children:[e]}:e);for(let e of t)v_(e,0);let n=o().use(x).use(b).use(a).use(r,{handlers:O_}).stringify({type:`root`,children:t});return typeof n==`string`?n:String(n)}function A_(e,t){let n=Rh(t),r=n.match(/`{3,}/g),i=r?Math.max(...r.map(e=>e.length))+1:3,a="`".repeat(i),o=``;t.attrs.placement&&t.attrs.placement!==`bottom-right`&&(o+=` placement="${t.attrs.placement}"`),t.attrs.actions===!0?o+=` actions={true}`:t.attrs.actions===!1&&(o+=` actions={false}`),e.write(a+`mermaid`+o+`
61
- `),e.write(n),e.ensureNewLine(),e.write(a),e.closeBlock()}function j_(e,t,n){let r=t.childCount>0?t.child(0):null,i=t.childCount>1?t.child(1):null,a=``;if(r){let t=new sg(e.options);n(t,r),a=t.out.trim()}let o=i?Rh(i):``,s=[];if(a){if(a.includes(`&`)){let e=Yh(t.attrs,`description`,a);e&&s.push(e)}else if(a.includes(`"`)){let e=a.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${");s.push(`description={\`${e}\`}`)}else s.push(`description="${a}"`)}t.attrs.icon&&s.push(`icon="${t.attrs.icon}"`),t.attrs.iconType&&s.push(`iconType="${t.attrs.iconType}"`);let c=Array.isArray(t.attrs.actions)?t.attrs.actions:[`copy`];s.push(`actions={[${c.map(e=>`"${e}"`).join(`, `)}]}`);let l=s.length>0?` `+s.join(` `):``;e.write(`<Prompt${l}${B_(t.attrs)}>`),o&&(e.ensureNewLine(),e.write(o)),e.ensureNewLine(),e.write(`</Prompt>`),e.closeBlock()}function M_(e){let t=[];if(e.name){let n=Uh({},`name`,e.name);n&&t.push(n)}if(e.rawValueExpr!==void 0)t.push(`value={${e.rawValueExpr}}`);else if(e.value!==void 0&&e.value!==null){let n=Uh({},`value`,e.value);n&&t.push(n)}return`<Color.Item${t.length?` `+t.join(` `):``} />`}function N_(e,t){let n=t.attrs.variant,r=t.attrs.colorData??[],i=n?` variant="${n}"`:``;e.write(`<Color${i}${B_(t.attrs)}>`),e.ensureNewLine();let a=e.delim;e.delim+=` `.repeat(e.indentSize);for(let t of r)if(t.type===`row`){let n=t.title?Uh({},`title`,t.title):null;e.write(`<Color.Row${n?` ${n}`:``}>`),e.ensureNewLine();let r=e.delim;e.delim+=` `.repeat(e.indentSize);for(let n of t.items)e.write(M_(n)),e.ensureNewLine();e.delim=r,e.closed=!1,e.ensureNewLine(),e.write(`</Color.Row>`),e.ensureNewLine()}else e.write(M_(t)),e.ensureNewLine();e.delim=a,e.closed=!1,e.ensureNewLine(),e.write(`</Color>`),e.closeBlock()}function P_(e){let t=[];for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=Uh({},n,r);e&&t.push(e)}return t.length?` `+t.join(` `):``}function F_(e,t){if(t.type===`file`){let n=P_({name:t.name});e.write(`<Tree.File${n} />`),e.ensureNewLine();return}let n=P_({name:t.name,defaultOpen:t.defaultOpen,openable:t.openable});if(t.children.length===0){e.write(`<Tree.Folder${n} />`),e.ensureNewLine();return}e.write(`<Tree.Folder${n}>`),e.ensureNewLine();let r=e.delim;e.delim+=` `.repeat(e.indentSize);for(let n of t.children)F_(e,n);e.delim=r,e.closed=!1,e.ensureNewLine(),e.write(`</Tree.Folder>`),e.ensureNewLine()}function I_(e,t){let n=[Uh(t.attrs,`id`,t.attrs.id),...[`view`,`sort`,`filter`,`groupBy`,`calendarBy`].map(e=>Jh(e,t.attrs[e])),typeof t.attrs.sql==`string`?Mn(t.attrs.sql):null].filter(Boolean),r=n.length>0?` ${n.join(` `)}`:``;e.write(`<Database${r}${B_(t.attrs,Yh)} />`),e.closeBlock()}function L_(e,t){let n=t.attrs.treeData??[],r=B_(t.attrs);if(n.length===0){e.write(`<Tree${r} />`),e.closeBlock();return}e.write(`<Tree${r}>`),e.ensureNewLine();let i=e.delim;e.delim+=` `.repeat(e.indentSize);for(let t of n)F_(e,t);e.delim=i,e.closed=!1,e.ensureNewLine(),e.write(`</Tree>`),e.closeBlock()}function R_(e){let t=e[ep];return Array.isArray(t)?t.map(e=>`{${e}}`):[]}function z_(e){let t=e[np];return!t||typeof t!=`object`?e:Object.assign(Object.assign({},e),t)}function B_(e,t=Uh){let n=e[np];if(!n||typeof n!=`object`)return``;let r=Object.entries(n);if(r.length===0)return``;let i=r.map(([e,r])=>t(n,e,r)).filter(Boolean);return i.length>0?` `+i.join(` `):``}var V_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},H_={tightLists:!0,indentSize:2,removeTrailingNewline:!0},U_=/* @__PURE__ */ new Set([`paragraph`,`heading`,`blockquote`,`bulletList`,`orderedList`,`table`,`horizontalRule`,O.codeBlock,O.image,O.video,O.callout,O.accordion,O.accordionGroup,O.card,O.steps,O.tabs,O.codeGroup,O.columns,O.frame,O.expandable,O.paramField,O.responseField,O.requestExample,O.responseExample,O.customComponent,O.staticHTML,O.unknownTag,O.mdxJsEsm,O.blockMath,O.mermaidBlock,O.promptBlock,O.color,O.tree,O.visibility,O.database]),W_=/* @__PURE__ */ new Set([`blockquote`,`bulletList`,`orderedList`]),G_=/* @__PURE__ */ new Set([`image`,O.image]),K_=/* @__PURE__ */ new Set([`definition`,`footnoteDefinition`]);function q_(e){let t=!1;return e.descendants(e=>{if(t)return!1;let n=e.attrs.mdxJsxNode;return n?.type&&K_.has(n.type)&&(t=!0),!t}),t}function J_(e,t={}){return X_(Z_(e,t,null)).mdx}function Y_(e,t,n){let r=new sg(t);return r.delim=n,lv(r,e,e,0),r.out.replace(/(\n[ \t]*)+$/,``)}function X_(e){let t=e.next();for(;!t.done;)t=e.next();return t.value}function*Z_(e,t,n){let{frontmatter:r}=t,i=V_(t,[`frontmatter`]),a=new sg(Object.assign(Object.assign({},i),{hasReferenceDefinitions:i.hasReferenceDefinitions??q_(e)}));if(a.sourceMap=n,r&&Object.keys(r).length>0){let e=Object.entries(wh(r));if(e.length>0){a.write(`---
60
+ `),y_=(e,t)=>{if(e.type===`mdxFlowExpression`){e.value=v_(e.value,g_-__*t);return}if(!(`children`in e))return;let n=e.type===`mdxJsxFlowElement`?t+1:t;for(let t of e.children)y_(t,n)},b_=e=>typeof e==`object`&&!!e&&(e.type===`mdxFlowExpression`||e.type===`mdxTextExpression`)&&typeof e.value==`string`;function x_(e,t){let n=t.attrs.mdxJsxNode;if(b_(n))e.write(`{${v_(n.value,g_)}}`),t.type.name===O.unknownTag&&e.closeBlock();else{if(n)try{let r=A_([n]),i=t.type.name===O.inlineUnknownTag?r.replace(/\n$/,``):r;e.write(i)}catch{e.write(`<!-- unknown tag -->`)}t.type.name===O.unknownTag&&e.closeBlock()}}function S_(e,t){let n=t.attrs.mdastNode;if(n)try{let t=A_([n]);e.write(t)}catch{e.write(`<!-- esm node -->`)}e.closeBlock()}var C_=/[\p{L}\p{N}]/u;function w_(e){return e.replace(/\\_/g,(t,n)=>{let r=e[n-1],i=e[n+2];return r!==void 0&&C_.test(r)&&i!==void 0&&C_.test(i)?`_`:t})}var T_=e=>{for(let t of e){let e=t.handlers?.mdxJsxFlowElement??T_(t.extensions??[]);if(e)return e}},E_=e=>p(e)&&e.name!==null&&e.children.length===0&&e.data?.closingTag===!0,D_=e=>(t,n,r,i)=>{let a=e(t,n,r,i);return E_(t)?a.replace(/ ?\/>$/,`></${t.name}>`):a},O_=T_(o().use(x).freeze().data(`toMarkdownExtensions`)??[]),k_=Object.assign({text:(e,t,n,r)=>w_(n.safe(e.value,r)),inlineMath:e=>`$$${e.value}$$`},O_&&{mdxJsxFlowElement:D_(O_),mdxJsxTextElement:D_(O_)});function A_(e){let t=structuredClone(e).map(e=>e?.type===`mdxJsxTextElement`?{type:`paragraph`,children:[e]}:e);for(let e of t)y_(e,0);let n=o().use(x).use(b).use(a).use(r,{handlers:k_}).stringify({type:`root`,children:t});return typeof n==`string`?n:String(n)}function j_(e,t){let n=Rh(t),r=n.match(/`{3,}/g),i=r?Math.max(...r.map(e=>e.length))+1:3,a="`".repeat(i),o=``;t.attrs.placement&&t.attrs.placement!==`bottom-right`&&(o+=` placement="${t.attrs.placement}"`),t.attrs.actions===!0?o+=` actions={true}`:t.attrs.actions===!1&&(o+=` actions={false}`),e.write(a+`mermaid`+o+`
61
+ `),e.write(n),e.ensureNewLine(),e.write(a),e.closeBlock()}function M_(e,t,n){let r=t.childCount>0?t.child(0):null,i=t.childCount>1?t.child(1):null,a=``;if(r){let t=new cg(e.options);n(t,r),a=t.out.trim()}let o=i?Rh(i):``,s=[];if(a){if(a.includes(`&`)){let e=Xh(t.attrs,`description`,a);e&&s.push(e)}else if(a.includes(`"`)){let e=a.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${");s.push(`description={\`${e}\`}`)}else s.push(`description="${a}"`)}t.attrs.icon&&s.push(`icon="${t.attrs.icon}"`),t.attrs.iconType&&s.push(`iconType="${t.attrs.iconType}"`);let c=Array.isArray(t.attrs.actions)?t.attrs.actions:[`copy`];s.push(`actions={[${c.map(e=>`"${e}"`).join(`, `)}]}`);let l=s.length>0?` `+s.join(` `):``;e.write(`<Prompt${l}${V_(t.attrs)}>`),o&&(e.ensureNewLine(),e.write(o)),e.ensureNewLine(),e.write(`</Prompt>`),e.closeBlock()}function N_(e){let t=[];if(e.name){let n=Uh({},`name`,e.name);n&&t.push(n)}if(e.rawValueExpr!==void 0)t.push(`value={${e.rawValueExpr}}`);else if(e.value!==void 0&&e.value!==null){let n=Uh({},`value`,e.value);n&&t.push(n)}return`<Color.Item${t.length?` `+t.join(` `):``} />`}function P_(e,t){let n=t.attrs.variant,r=t.attrs.colorData??[],i=n?` variant="${n}"`:``;e.write(`<Color${i}${V_(t.attrs)}>`),e.ensureNewLine();let a=e.delim;e.delim+=` `.repeat(e.indentSize);for(let t of r)if(t.type===`row`){let n=t.title?Uh({},`title`,t.title):null;e.write(`<Color.Row${n?` ${n}`:``}>`),e.ensureNewLine();let r=e.delim;e.delim+=` `.repeat(e.indentSize);for(let n of t.items)e.write(N_(n)),e.ensureNewLine();e.delim=r,e.closed=!1,e.ensureNewLine(),e.write(`</Color.Row>`),e.ensureNewLine()}else e.write(N_(t)),e.ensureNewLine();e.delim=a,e.closed=!1,e.ensureNewLine(),e.write(`</Color>`),e.closeBlock()}function F_(e){let t=[];for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=Uh({},n,r);e&&t.push(e)}return t.length?` `+t.join(` `):``}function I_(e,t){if(t.type===`file`){let n=F_({name:t.name});e.write(`<Tree.File${n} />`),e.ensureNewLine();return}let n=F_({name:t.name,defaultOpen:t.defaultOpen,openable:t.openable});if(t.children.length===0){e.write(`<Tree.Folder${n} />`),e.ensureNewLine();return}e.write(`<Tree.Folder${n}>`),e.ensureNewLine();let r=e.delim;e.delim+=` `.repeat(e.indentSize);for(let n of t.children)I_(e,n);e.delim=r,e.closed=!1,e.ensureNewLine(),e.write(`</Tree.Folder>`),e.ensureNewLine()}function L_(e,t){let n=[Uh(t.attrs,`id`,t.attrs.id),...[`view`,`sort`,`filter`,`groupBy`,`calendarBy`].map(e=>Yh(e,t.attrs[e])),typeof t.attrs.sql==`string`?Mn(t.attrs.sql):null].filter(Boolean),r=n.length>0?` ${n.join(` `)}`:``;e.write(`<Database${r}${V_(t.attrs,Xh)} />`),e.closeBlock()}function R_(e,t){let n=t.attrs.treeData??[],r=V_(t.attrs);if(n.length===0){e.write(`<Tree${r} />`),e.closeBlock();return}e.write(`<Tree${r}>`),e.ensureNewLine();let i=e.delim;e.delim+=` `.repeat(e.indentSize);for(let t of n)I_(e,t);e.delim=i,e.closed=!1,e.ensureNewLine(),e.write(`</Tree>`),e.closeBlock()}function z_(e){let t=e[ep];return Array.isArray(t)?t.map(e=>`{${e}}`):[]}function B_(e){let t=e[np];return!t||typeof t!=`object`?e:Object.assign(Object.assign({},e),t)}function V_(e,t=Uh){let n=e[np];if(!n||typeof n!=`object`)return``;let r=Object.entries(n);if(r.length===0)return``;let i=r.map(([e,r])=>t(n,e,r)).filter(Boolean);return i.length>0?` `+i.join(` `):``}var H_=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},U_={tightLists:!0,indentSize:2,removeTrailingNewline:!0},W_=/* @__PURE__ */ new Set([`paragraph`,`heading`,`blockquote`,`bulletList`,`orderedList`,`table`,`horizontalRule`,O.codeBlock,O.image,O.video,O.callout,O.accordion,O.accordionGroup,O.card,O.steps,O.tabs,O.codeGroup,O.columns,O.frame,O.expandable,O.paramField,O.responseField,O.requestExample,O.responseExample,O.customComponent,O.staticHTML,O.unknownTag,O.mdxJsEsm,O.blockMath,O.mermaidBlock,O.promptBlock,O.color,O.tree,O.visibility,O.database]),G_=/* @__PURE__ */ new Set([`blockquote`,`bulletList`,`orderedList`]),K_=/* @__PURE__ */ new Set([`image`,O.image]),q_=/* @__PURE__ */ new Set([`definition`,`footnoteDefinition`]);function J_(e){let t=!1;return e.descendants(e=>{if(t)return!1;let n=e.attrs.mdxJsxNode;return n?.type&&q_.has(n.type)&&(t=!0),!t}),t}function Y_(e,t={}){return Z_(Q_(e,t,null)).mdx}function X_(e,t,n){let r=new cg(t);return r.delim=n,uv(r,e,e,0),r.out.replace(/(\n[ \t]*)+$/,``)}function Z_(e){let t=e.next();for(;!t.done;)t=e.next();return t.value}function*Q_(e,t,n){let{frontmatter:r}=t,i=H_(t,[`frontmatter`]),a=new cg(Object.assign(Object.assign({},i),{hasReferenceDefinitions:i.hasReferenceDefinitions??J_(e)}));if(a.sourceMap=n,r&&Object.keys(r).length>0){let e=Object.entries(wh(r));if(e.length>0){a.write(`---
62
62
  `);for(let[t,n]of e)a.write(`${Ih(t,n)}
63
63
  `);a.write(`---
64
64
 
65
- `)}}for(let t=0;t<e.childCount;t++)$_(a,e,t),yield t+1;let o=a.out;t.removeTrailingNewline!==!1&&o.endsWith(`
66
- `)&&(o=o.replace(/\n+$/,``));for(let e of n??[])e.end=Math.min(e.end,o.length),e.start=Math.min(e.start,e.end);return{mdx:o,sourceMap:n??[]}}function Q_(e,t,n=0){for(let r=n;r<t.childCount;r++)$_(e,t,r,n)}function $_(e,t,n,r=0){let i=t.child(n);if(n>r){e.ensureNewLine();let r=t.child(n-1);ov(r,i)&&e.ensureNewLine(),ev(r,i)&&e.keptBlankLines.add(e.length)}let a=e.beginBlock(n);lv(e,i,t,n),e.endBlock(a)}function ev(e,t){return tv(t)?e.type.name===`paragraph`?tv(e):G_.has(e.type.name)?xg(e):e.type.name===`table`?Rg(e):W_.has(e.type.name):!1}function tv(e){return e.type.name===`paragraph`&&e.content.size>0}function nv(e,t){Q_(e,t,+!!iv(t))}function rv(e){let t=e.firstChild,n=e.maybeChild(1);return e.type.name===`listItem`&&t?.type.name===`paragraph`&&t.childCount===0&&n!==null&&n.type.name!==`paragraph`}function iv(e){let t=e.maybeChild(1);return rv(e)&&t!==null&&av(e,t)}var av=(e,t)=>e.attrs.checked==null||t.type.name===O.image;function ov(e,t){return U_.has(e.type.name)||U_.has(t.type.name)}var sv={renderInlineImage:(e,t)=>jg(e,t),renderIcon:(e,t)=>o_(e,t),renderBadge:(e,t)=>s_(e,t),renderTooltip:(e,t)=>c_(e,t,cv),renderUnknownTag:(e,t)=>b_(e,t)};function cv(e,t){pg(e,t,lv,sv)}function lv(e,t,n,r){let i=t.type.name;switch(i){case`doc`:Q_(e,t);break;case`paragraph`:cv(e,t),e.closeBlock();break;case`heading`:{let n=t.attrs.level||1,r=t.attrs.customId;r&&e.delim?(e.write(`<h${n} id="${r}">`),e.ensureNewLine(),cv(e,t),e.ensureNewLine(),e.write(`</h${n}>`)):(e.write(`#`.repeat(n)+` `),cv(e,t),r&&e.write(` {#${r}}`)),e.closeBlock();break}case`blockquote`:Fg(e,t,lv);break;case`bulletList`:Ig(e,t,!1,nv);break;case`orderedList`:Ig(e,t,!0,nv);break;case`horizontalRule`:e.write(`---`),e.closeBlock();break;case`hardBreak`:e.write(`<br />`);break;case`text`:mg(e,t);break;case`table`:Lg(e,t,cv,lv);break;case O.codeBlock:Jg(e,t,[0]);break;case`image`:case O.image:Sg(e,t);break;case O.inlineImage:jg(e,t);break;case O.video:Mg(e,t);break;case O.callout:e_(e,t,Q_),e.closeBlock();break;case O.card:t_(e,t,`Card`,Q_,cv),e.closeBlock();break;case O.cardTitle:break;case O.cardBody:Q_(e,t);break;case O.accordion:t_(e,t,`Accordion`,Q_,cv),e.closeBlock();break;case O.accordionTitle:break;case O.accordionBody:Q_(e,t);break;case O.step:t_(e,t,`Step`,Q_,cv,[`isLast`]);break;case O.stepTitle:break;case O.stepBody:Q_(e,t);break;case O.column:case O.tab:n_(e,t,i,Q_);break;case O.columns:case O.accordionGroup:case O.steps:case O.tabs:case O.update:case O.frame:case O.expandable:case O.paramField:case O.responseField:case O.visibility:n_(e,t,i,Q_),e.closeBlock();break;case O.codeGroup:case O.requestExample:case O.responseExample:i_(e,t,i);break;case O.customComponent:a_(e,t,Q_),e.closeBlock();break;case O.icon:o_(e,t);break;case O.badge:s_(e,t);break;case O.tooltip:c_(e,t,cv);break;case O.staticHTML:case O.inlineStaticHTML:m_(e,t,Q_,cv);break;case O.unknownTag:case O.inlineUnknownTag:b_(e,t);break;case O.mdxJsEsm:x_(e,t);break;case O.inlineMath:t.attrs.expression&&e.write(`$$${t.attrs.expression}$$`);break;case O.blockMath:t.attrs.expression&&(e.write(`$$`),e.ensureNewLine(),e.write(String(t.attrs.expression)),e.ensureNewLine(),e.write(`$$`),e.closeBlock());break;case O.color:N_(e,t);break;case O.tree:L_(e,t);break;case O.database:I_(e,t);break;case O.mermaidBlock:A_(e,t);break;case O.promptBlock:j_(e,t,Q_);break;case O.promptDescription:break;case`listItem`:nv(e,t);break;default:Q_(e,t)}}var uv=(e,t)=>{if(e===t)return!0;if(e.type!==t.type||e.text!==t.text||!dv(e.attrs,t.attrs)||!_v(e.marks,t.marks))return!1;let n=e.content,r=t.content;if(!n&&!r)return!0;if(!n||!r||n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(!uv(n[e],r[e]))return!1;return!0},dv=(e,t)=>{if(e===t||!e&&!t)return!0;if(!e||!t)return!1;let n=Object.keys(e).filter(e=>!kt.has(e)),r=Object.keys(t).filter(e=>!kt.has(e));if(n.length!==r.length)return!1;for(let r of n)if(!(r===`mdxJsxNode`&&`tagName`in e&&pv(e[r],t[r]))&&gv(r,e[r])!==gv(r,t[r]))return!1;return!0},fv=e=>p(e)&&!!e.name&&Tt.has(e.name),pv=(e,t)=>e===null&&fv(t)||t===null&&fv(e),mv=e=>typeof e==`object`&&!!e&&`start`in e&&`end`in e,hv=e=>typeof e==`object`&&!!e&&`start`in e&&`end`in e,gv=(e,t)=>At.has(e)?JSON.stringify(t,function(e,t){if(!(e===`position`&&mv(t))&&!(e===`loc`&&hv(t))&&(e!==`start`&&e!==`end`||typeof t!=`number`||typeof this.start!=`number`||typeof this.end!=`number`)&&!(e===`range`&&Array.isArray(t)))return t}):JSON.stringify(t),_v=(e,t)=>{if(e===t||!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.type!==i.type||!dv(r.attrs,i.attrs))return!1}return!0},vv=(e,t)=>{if(e.text!=null)return e.text.length;let n=t.nodes[e.type];if(!n)return 1;if(!e.content||e.content.length===0)return n.spec.content&&n.spec.content.length>0?2:1;let r=2;for(let n of e.content)r+=vv(n,t);return r},yv=e=>e.text==null?e.content?e.content.map(yv).join(``):``:e.text,bv=(e,t)=>{if(e===t||e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let n=Math.min(e.length,t.length),r=Math.max(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i++;let a=i/r,o=new Set(e.toLowerCase().split(/\s+/)),s=new Set(t.toLowerCase().split(/\s+/)),c=0;for(let e of o)s.has(e)&&c++;let l=(/* @__PURE__ */ new Set([...o,...s])).size,u=l>0?c/l:0;return Math.max(a,u)},xv=(e,t,n)=>{if(e.type!==t.type)return!1;if(e.text!=null)return!0;let r=e.type?n.nodes[e.type]:void 0;if(r?.isLeaf)return!0;if(r?.isTextblock){let n=yv(e),r=yv(t);if(n.length===0||r.length===0)return!0;let i=e.type===`heading`&&e.attrs?.level===t.attrs?.level?.15:.3;return bv(n,r)>i}let i=yv(e),a=yv(t);return i.length===0||a.length===0||bv(i,a)>.15},Sv=(e,t)=>t.nodes[e]?.isTextblock??!1,Cv=(e,t)=>t.nodes[e]?.isLeaf??!1,wv=(e,t)=>t.nodes[e]?.spec.code??!1,Tv=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Ev=/^\s*<h[1-6] id="/,Dv=/^\s*<\/h[1-6]>$/,Ov=25e6,kv=/^([-*+]|(\d+)([.)]))[ \t]+/,Av=/* @__PURE__ */ new Set([O.card,O.accordion,O.step]),jv=/* @__PURE__ */ new Set([`bulletList`,`orderedList`]),Mv=/* @__PURE__ */ new Set([O.callout,O.card,O.accordion,O.accordionGroup,O.step,O.steps,O.tab,O.tabs,O.column,O.columns,O.update,O.frame,O.expandable,O.paramField,O.responseField,O.visibility,O.customComponent,O.codeGroup,O.requestExample,O.responseExample]);function Nv(e,t){let{source:n,parseOptions:r,onFallback:i,frontmatter:a}=t,o=Tv(t,[`source`,`parseOptions`,`onFallback`,`frontmatter`]),s=Object.assign(Object.assign({},o),{frontmatter:a}),c=(t,n,r)=>(i?.(t,n,r),J_(e,s));try{let t=Iv.create(e,n,r??{},o);if(!t)return c(`unmappable`);let i=t.run(a);return i===null?c(`alignment`):t.roundTrips(i)?i:c(`roundtrip`,i)}catch(e){return c(`error`,void 0,e)}}var Pv=class e{constructor(e,t,n){this.source=e,this.lineMap=n,this.lineStarts=$v(e),this.origLines=e.split(`
65
+ `)}}for(let t=0;t<e.childCount;t++)ev(a,e,t),yield t+1;let o=a.out;t.removeTrailingNewline!==!1&&o.endsWith(`
66
+ `)&&(o=o.replace(/\n+$/,``));for(let e of n??[])e.end=Math.min(e.end,o.length),e.start=Math.min(e.start,e.end);return{mdx:o,sourceMap:n??[]}}function $_(e,t,n=0){for(let r=n;r<t.childCount;r++)ev(e,t,r,n)}function ev(e,t,n,r=0){let i=t.child(n);if(n>r){e.ensureNewLine();let r=t.child(n-1);sv(r,i)&&e.ensureNewLine(),tv(r,i)&&e.keptBlankLines.add(e.length)}let a=e.beginBlock(n);uv(e,i,t,n),e.endBlock(a)}function tv(e,t){return nv(t)?e.type.name===`paragraph`?nv(e):K_.has(e.type.name)?Sg(e):e.type.name===`table`?zg(e):G_.has(e.type.name):!1}function nv(e){return e.type.name===`paragraph`&&e.content.size>0}function rv(e,t){$_(e,t,+!!av(t))}function iv(e){let t=e.firstChild,n=e.maybeChild(1);return e.type.name===`listItem`&&t?.type.name===`paragraph`&&t.childCount===0&&n!==null&&n.type.name!==`paragraph`}function av(e){let t=e.maybeChild(1);return iv(e)&&t!==null&&ov(e,t)}var ov=(e,t)=>e.attrs.checked==null||t.type.name===O.image;function sv(e,t){return W_.has(e.type.name)||W_.has(t.type.name)}var cv={renderInlineImage:(e,t)=>Mg(e,t),renderIcon:(e,t)=>s_(e,t),renderBadge:(e,t)=>c_(e,t),renderTooltip:(e,t)=>l_(e,t,lv),renderUnknownTag:(e,t)=>x_(e,t)};function lv(e,t){mg(e,t,uv,cv)}function uv(e,t,n,r){let i=t.type.name;switch(i){case`doc`:$_(e,t);break;case`paragraph`:lv(e,t),e.closeBlock();break;case`heading`:{let n=t.attrs.level||1,r=t.attrs.customId;r&&e.delim?(e.write(`<h${n} id="${r}">`),e.ensureNewLine(),lv(e,t),e.ensureNewLine(),e.write(`</h${n}>`)):(e.write(`#`.repeat(n)+` `),lv(e,t),r&&e.write(` {#${r}}`)),e.closeBlock();break}case`blockquote`:Ig(e,t,uv);break;case`bulletList`:Lg(e,t,!1,rv);break;case`orderedList`:Lg(e,t,!0,rv);break;case`horizontalRule`:e.write(`---`),e.closeBlock();break;case`hardBreak`:e.write(`<br />`);break;case`text`:hg(e,t);break;case`table`:Rg(e,t,lv,uv);break;case O.codeBlock:Yg(e,t,[0]);break;case`image`:case O.image:Cg(e,t);break;case O.inlineImage:Mg(e,t);break;case O.video:Ng(e,t);break;case O.callout:t_(e,t,$_),e.closeBlock();break;case O.card:n_(e,t,`Card`,$_,lv),e.closeBlock();break;case O.cardTitle:break;case O.cardBody:$_(e,t);break;case O.accordion:n_(e,t,`Accordion`,$_,lv),e.closeBlock();break;case O.accordionTitle:break;case O.accordionBody:$_(e,t);break;case O.step:n_(e,t,`Step`,$_,lv,[`isLast`]);break;case O.stepTitle:break;case O.stepBody:$_(e,t);break;case O.column:case O.tab:r_(e,t,i,$_);break;case O.columns:case O.accordionGroup:case O.steps:case O.tabs:case O.update:case O.frame:case O.expandable:case O.paramField:case O.responseField:case O.visibility:r_(e,t,i,$_),e.closeBlock();break;case O.codeGroup:case O.requestExample:case O.responseExample:a_(e,t,i);break;case O.customComponent:o_(e,t,$_),e.closeBlock();break;case O.icon:s_(e,t);break;case O.badge:c_(e,t);break;case O.tooltip:l_(e,t,lv);break;case O.staticHTML:case O.inlineStaticHTML:h_(e,t,$_,lv);break;case O.unknownTag:case O.inlineUnknownTag:x_(e,t);break;case O.mdxJsEsm:S_(e,t);break;case O.inlineMath:t.attrs.expression&&e.write(`$$${t.attrs.expression}$$`);break;case O.blockMath:t.attrs.expression&&(e.write(`$$`),e.ensureNewLine(),e.write(String(t.attrs.expression)),e.ensureNewLine(),e.write(`$$`),e.closeBlock());break;case O.color:P_(e,t);break;case O.tree:R_(e,t);break;case O.database:L_(e,t);break;case O.mermaidBlock:j_(e,t);break;case O.promptBlock:M_(e,t,$_);break;case O.promptDescription:break;case`listItem`:rv(e,t);break;default:$_(e,t)}}var dv=(e,t)=>{if(e===t)return!0;if(e.type!==t.type||e.text!==t.text||!fv(e.attrs,t.attrs)||!vv(e.marks,t.marks))return!1;let n=e.content,r=t.content;if(!n&&!r)return!0;if(!n||!r||n.length!==r.length)return!1;for(let e=0;e<n.length;e++)if(!dv(n[e],r[e]))return!1;return!0},fv=(e,t)=>{if(e===t||!e&&!t)return!0;if(!e||!t)return!1;let n=Object.keys(e).filter(e=>!kt.has(e)),r=Object.keys(t).filter(e=>!kt.has(e));if(n.length!==r.length)return!1;for(let r of n)if(!(r===`mdxJsxNode`&&`tagName`in e&&mv(e[r],t[r]))&&_v(r,e[r])!==_v(r,t[r]))return!1;return!0},pv=e=>p(e)&&!!e.name&&Tt.has(e.name),mv=(e,t)=>e===null&&pv(t)||t===null&&pv(e),hv=e=>typeof e==`object`&&!!e&&`start`in e&&`end`in e,gv=e=>typeof e==`object`&&!!e&&`start`in e&&`end`in e,_v=(e,t)=>At.has(e)?JSON.stringify(t,function(e,t){if(!(e===`position`&&hv(t))&&!(e===`loc`&&gv(t))&&(e!==`start`&&e!==`end`||typeof t!=`number`||typeof this.start!=`number`||typeof this.end!=`number`)&&!(e===`range`&&Array.isArray(t)))return t}):JSON.stringify(t),vv=(e,t)=>{if(e===t||!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.type!==i.type||!fv(r.attrs,i.attrs))return!1}return!0},yv=(e,t)=>{if(e.text!=null)return e.text.length;let n=t.nodes[e.type];if(!n)return 1;if(!e.content||e.content.length===0)return n.spec.content&&n.spec.content.length>0?2:1;let r=2;for(let n of e.content)r+=yv(n,t);return r},bv=e=>e.text==null?e.content?e.content.map(bv).join(``):``:e.text,xv=(e,t)=>{if(e===t||e.length===0&&t.length===0)return 1;if(e.length===0||t.length===0)return 0;let n=Math.min(e.length,t.length),r=Math.max(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i++;let a=i/r,o=new Set(e.toLowerCase().split(/\s+/)),s=new Set(t.toLowerCase().split(/\s+/)),c=0;for(let e of o)s.has(e)&&c++;let l=(/* @__PURE__ */ new Set([...o,...s])).size,u=l>0?c/l:0;return Math.max(a,u)},Sv=(e,t,n)=>{if(e.type!==t.type)return!1;if(e.text!=null)return!0;let r=e.type?n.nodes[e.type]:void 0;if(r?.isLeaf)return!0;if(r?.isTextblock){let n=bv(e),r=bv(t);if(n.length===0||r.length===0)return!0;let i=e.type===`heading`&&e.attrs?.level===t.attrs?.level?.15:.3;return xv(n,r)>i}let i=bv(e),a=bv(t);return i.length===0||a.length===0||xv(i,a)>.15},Cv=(e,t)=>t.nodes[e]?.isTextblock??!1,wv=(e,t)=>t.nodes[e]?.isLeaf??!1,Tv=(e,t)=>t.nodes[e]?.spec.code??!1,Ev=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Dv=/^\s*<h[1-6] id="/,Ov=/^\s*<\/h[1-6]>$/,kv=25e6,Av=/^([-*+]|(\d+)([.)]))[ \t]+/,jv=/* @__PURE__ */ new Set([O.card,O.accordion,O.step]),Mv=/* @__PURE__ */ new Set([`bulletList`,`orderedList`]),Nv=/* @__PURE__ */ new Set([O.callout,O.card,O.accordion,O.accordionGroup,O.step,O.steps,O.tab,O.tabs,O.column,O.columns,O.update,O.frame,O.expandable,O.paramField,O.responseField,O.visibility,O.customComponent,O.codeGroup,O.requestExample,O.responseExample]);function Pv(e,t){let{source:n,parseOptions:r,onFallback:i,frontmatter:a}=t,o=Ev(t,[`source`,`parseOptions`,`onFallback`,`frontmatter`]),s=Object.assign(Object.assign({},o),{frontmatter:a}),c=(t,n,r)=>(i?.(t,n,r),Y_(e,s));try{let t=Lv.create(e,n,r??{},o);if(!t)return c(`unmappable`);let i=t.run(a);return i===null?c(`alignment`):t.roundTrips(i)?i:c(`roundtrip`,i)}catch(e){return c(`error`,void 0,e)}}var Fv=class e{constructor(e,t,n){this.source=e,this.lineMap=n,this.lineStarts=ey(e),this.origLines=e.split(`
67
67
  `),this.preLines=t.split(`
68
- `)}static create(t,n,r){let i=ey(n,r);return i?new e(t,r,i):null}lineStart(e){return this.source.lastIndexOf(`
69
- `,e-1)+1}lineEnd(e){return e+1<this.lineStarts.length?this.lineStarts[e+1]-1:this.source.length}exact(e,t){return this.preLines[e]===this.origLines[t]}span(e){let t=e.position;if(!t)return null;let n=this.lineMap[t.start.line-1],r=this.lineMap[t.end.line-1];if(n===void 0||r===void 0)return null;let i=this.exact(t.start.line-1,n)?this.lineStarts[n]+t.start.column-1:this.lineStarts[n],a=this.exact(t.end.line-1,r)?this.lineStarts[r]+t.end.column-1:this.lineEnd(r);return i>a||a>this.source.length?null:{start:i,end:a}}},Fv=class{constructor(e,t,n){this.source=e,this.src=t,this.frame=n,this.out=``,this.first=!0,this.prevSrc=null,this.prevType=null}sep(e,t,n){let{frame:r}=this;if(this.first){this.out+=r.open,n&&r.kind===`jsx`&&!/\n[ \t]*$/.test(r.open)&&(this.out+=`
68
+ `)}static create(t,n,r){let i=ty(n,r);return i?new e(t,r,i):null}lineStart(e){return this.source.lastIndexOf(`
69
+ `,e-1)+1}lineEnd(e){return e+1<this.lineStarts.length?this.lineStarts[e+1]-1:this.source.length}exact(e,t){return this.preLines[e]===this.origLines[t]}span(e){let t=e.position;if(!t)return null;let n=this.lineMap[t.start.line-1],r=this.lineMap[t.end.line-1];if(n===void 0||r===void 0)return null;let i=this.exact(t.start.line-1,n)?this.lineStarts[n]+t.start.column-1:this.lineStarts[n],a=this.exact(t.end.line-1,r)?this.lineStarts[r]+t.end.column-1:this.lineEnd(r);return i>a||a>this.source.length?null:{start:i,end:a}}},Iv=class{constructor(e,t,n){this.source=e,this.src=t,this.frame=n,this.out=``,this.first=!0,this.prevSrc=null,this.prevType=null}sep(e,t,n){let{frame:r}=this;if(this.first){this.out+=r.open,n&&r.kind===`jsx`&&!/\n[ \t]*$/.test(r.open)&&(this.out+=`
70
70
  ${r.indent}`),this.first=!1;return}if(e!==null&&this.prevSrc!==null&&e===this.prevSrc+1){this.out+=this.source.slice(this.src[this.prevSrc].end,this.src[e].start);return}let i=r.kind===`item`&&r.sepBody===`
71
71
  `&&this.prevType===`paragraph`&&t===`paragraph`;this.out+=(i?`
72
72
 
@@ -78,24 +78,24 @@ ${r.indent}`),this.first=!1;return}if(e!==null&&this.prevSrc!==null&&e===this.pr
78
78
  `:this.out:e.close?e.close.startsWith(`
79
79
  `)||!this.out.slice(e.open.length).includes(`
80
80
  `)?this.out+e.close:`${this.out}
81
- ${e.containerIndent}${e.close}`:this.out}},Iv=class e{constructor(e,t,n,r,i){this.doc=e,this.coords=t,this.root=n,this.parseOptions=r,this.ser=i,this.keyIds=/* @__PURE__ */ new Map,this.source=t.source,this.schema=e.type.schema,this.emptyParagraph=this.schema.nodes.paragraph.create()}static create(t,n,r,i){let{sanitized:a,preprocessed:o}=Kf(n,r),s=Pv.create(n,a,o);if(!s)return null;let c=Qf(o),l=Object.assign(Object.assign({},i),{removeTrailingNewline:!0,hasReferenceDefinitions:q_(t)});return new e(t,s,c,r,l)}roundTrips(e){let t=e=>J_($m(e,Object.assign(Object.assign({},this.parseOptions),{schema:this.schema})).doc,this.ser),n=J_(this.doc,this.ser),r=t(e);return r===n||r===t(n)}run(e){let t=this.buildSrcChildren(this.root.children);if(!t)return null;let n=Lv(this.doc),r=this.frontmatterText(e),i=e===void 0||r===``,a=i?{kind:`rewrite`}:Vv(Un(this.root),e),o={omitted:i,unchanged:a.kind===`same`,appended:a.kind===`append`?a.lines:null,record:e,canonical:r,hasYaml:t.some(e=>e.mdast.type===`yaml`)};if(t.length===0&&n.length===0&&o.omitted)return this.source;let s={kind:`top`,open:t.length>0&&!(o.omitted&&o.hasYaml)?this.source.slice(0,t[0].start):``,close:t.length>0?this.source.slice(t[t.length-1].end):``,indent:``,containerIndent:``,sepBody:`
81
+ ${e.containerIndent}${e.close}`:this.out}},Lv=class e{constructor(e,t,n,r,i){this.doc=e,this.coords=t,this.root=n,this.parseOptions=r,this.ser=i,this.keyIds=/* @__PURE__ */ new Map,this.source=t.source,this.schema=e.type.schema,this.emptyParagraph=this.schema.nodes.paragraph.create()}static create(t,n,r,i){let{sanitized:a,preprocessed:o}=Kf(n,r),s=Fv.create(n,a,o);if(!s)return null;let c=Qf(o),l=Object.assign(Object.assign({},i),{removeTrailingNewline:!0,hasReferenceDefinitions:J_(t)});return new e(t,s,c,r,l)}roundTrips(e){let t=e=>Y_($m(e,Object.assign(Object.assign({},this.parseOptions),{schema:this.schema})).doc,this.ser),n=Y_(this.doc,this.ser),r=t(e);return r===n||r===t(n)}run(e){let t=this.buildSrcChildren(this.root.children);if(!t)return null;let n=Rv(this.doc),r=this.frontmatterText(e),i=e===void 0||r===``,a=i?{kind:`rewrite`}:Hv(Un(this.root),e),o={omitted:i,unchanged:a.kind===`same`,appended:a.kind===`append`?a.lines:null,record:e,canonical:r,hasYaml:t.some(e=>e.mdast.type===`yaml`)};if(t.length===0&&n.length===0&&o.omitted)return this.source;let s={kind:`top`,open:t.length>0&&!(o.omitted&&o.hasYaml)?this.source.slice(0,t[0].start):``,close:t.length>0?this.source.slice(t[t.length-1].end):``,indent:``,containerIndent:``,sepBody:`
82
82
 
83
- `,list:null};return this.emitLevel({outerOpen:``,innerOpen:``,close:``,chain:[]},n,t,s,o)}frontmatterText(e){let t=this.schema.topNodeType.createAndFill();return t?J_(t,Object.assign(Object.assign({},this.ser),{frontmatter:e})):``}keyOf(e){let t=Qv(e,this.ser),n=this.keyIds.get(t);return n===void 0&&(n=this.keyIds.size,this.keyIds.set(t,n)),n}buildSrcChildren(e){let t=[];for(let n of e)for(let e of Kv(n)){let n=this.coords.span(e);if(!n)return null;t.push({mdast:e,start:n.start,end:n.end,keys:null,node:null,nodes:null})}return t}linePrefix(e){return this.source.slice(this.coords.lineStart(e),e)}wrapperOpen(e,t,n){let r=this.linePrefix(t),i=e.outerOpen+e.innerOpen;if(!/^[ \t]*$/.test(r))return i;if(/^[ \t]*$/.test(i))return r;if(n)return i;let a=i.lastIndexOf(`
83
+ `,list:null};return this.emitLevel({outerOpen:``,innerOpen:``,close:``,chain:[]},n,t,s,o)}frontmatterText(e){let t=this.schema.topNodeType.createAndFill();return t?Y_(t,Object.assign(Object.assign({},this.ser),{frontmatter:e})):``}keyOf(e){let t=$v(e,this.ser),n=this.keyIds.get(t);return n===void 0&&(n=this.keyIds.size,this.keyIds.set(t,n)),n}buildSrcChildren(e){let t=[];for(let n of e)for(let e of qv(n)){let n=this.coords.span(e);if(!n)return null;t.push({mdast:e,start:n.start,end:n.end,keys:null,node:null,nodes:null})}return t}linePrefix(e){return this.source.slice(this.coords.lineStart(e),e)}wrapperOpen(e,t,n){let r=this.linePrefix(t),i=e.outerOpen+e.innerOpen;if(!/^[ \t]*$/.test(r))return i;if(/^[ \t]*$/.test(i))return r;if(n)return i;let a=i.lastIndexOf(`
84
84
  `),o=i.slice(a+1);return/^[ \t]*$/.test(o)?i.slice(0,a+1)+r:`${i.trimEnd()}
85
- ${r}`}parseInContext(e,t,n,r){return this.parseText(e,this.source.slice(t,n),t,r)}parseText(e,t,n,r){let i;try{i=$m(this.wrapperOpen(e,n,r)+t+e.close,Object.assign(Object.assign({},this.parseOptions),{schema:this.schema})).doc}catch{return null}let a=i;for(let t of e.chain){let e=Rv(a);if(e.length!==1||e[0].type.name!==t)return null;a=e[0]}return Rv(a)}fillKeys(e,t,n){if(t.mdast.type===`yaml`)return;let r=this.parseInContext(e,t.start,t.end,n);t.keys=r?r.map(e=>this.keyOf(e)):null,t.node=r&&r.length===1?r[0]:null,t.nodes=r}coalesce(e,t,n){let r=!1;for(let i=t.length-2;i>=0;i--){let a=t[i],o=t[i+1];if(!a.keys?.length||!o.keys?.length||n[i]!==null||n[i+1]!==null)continue;let s=this.parseInContext(e,a.start,o.end,i===0);if(!s)continue;let c=s.map(e=>this.keyOf(e));zv(c,[...a.keys,...o.keys])||(t.splice(i,2,{mdast:a.mdast,start:a.start,end:o.end,keys:c,node:s.length===1?s[0]:null,nodes:s}),r=!0)}return r}emitLevel(e,t,n,r,i){let a=t.map(e=>this.keyOf(e));n.forEach((t,n)=>this.fillKeys(e,t,n===0));let o=ty(n,a);if(!o||this.coalesce(e,n,o)&&(o=ty(n,a),!o))return null;Wv(n,t,o);let s=new Fv(this.source,n,r),c=[],l=0,u=e=>{for(let t=0;t<e;t++){let e=c[t];n[e].keys?.length===0&&s.verbatim(e)}},d=t=>{let i=t.type.name,a=c.findIndex(e=>{let t=n[e];return t.keys!==null&&t.keys.length>0&&t.node?.type.name===i});if(a===-1){s.canonical(this.renderCanonical(t,l,r),i);return}u(a);let o=c[a];c.splice(0,a+1);let d=this.tryRecurse(e,t,n[o],r)??this.tryPatchParagraph(e,t,n[o],o===0);d===null?s.canonical(this.renderCanonical(t,l,r),i):s.recursed(o,d,i)},f=e=>{for(;l<e;)d(t[l]),l++},p=()=>{u(c.length),c.length=0};i&&!i.omitted&&!i.hasYaml&&s.raw(i.canonical);for(let e=0;e<n.length;e++){let t=n[e];if(t.mdast.type===`yaml`){if(!i)return null;let n=i.appended===null?null:Uv(this.source.slice(t.start,t.end),i.appended,i.record);i.unchanged?s.verbatim(e):n===null?i.omitted||s.raw(i.canonical):s.recursed(e,n,`yaml`);continue}let r=o[e];r==null?c.push(e):(f(r),p(),l=r+t.keys.length,s.verbatim(e))}return f(t.length),p(),s.finish()}tryRecurse(e,t,n,r){let i=n.node;if(!i||i.type.name!==t.type.name)return null;let a=t.type.name;if(a===`table`)return this.emitTable(t,n);if(!Mv.has(a)&&!jv.has(a)&&a!==`listItem`||a===O.customComponent&&t.attrs.name===`CodeBlock`)return null;let o=jv.has(a)?`list`:a===`listItem`?`item`:`jsx`,s=o===`jsx`?this.resolveElement(n):n;if(!s)return null;let c=s.mdast.children;if(!c||c.length===0)return null;let l=this.buildSrcChildren(c);if(!l)return null;let u=l[0],d=l[l.length-1];if(u.start<s.start||d.end>s.end)return null;let f=this.source.slice(s.start,u.start),p=this.source.slice(d.end,s.end);if(this.shellKey(i)===this.shellKey(t)){if(!Gv(this.hollow(i),this.hollow(t)))return null}else{if(o!==`jsx`)return null;let e=Qv(this.hollow(t),this.ser).split(`
85
+ ${r}`}parseInContext(e,t,n,r){return this.parseText(e,this.source.slice(t,n),t,r)}parseText(e,t,n,r){let i;try{i=$m(this.wrapperOpen(e,n,r)+t+e.close,Object.assign(Object.assign({},this.parseOptions),{schema:this.schema})).doc}catch{return null}let a=i;for(let t of e.chain){let e=zv(a);if(e.length!==1||e[0].type.name!==t)return null;a=e[0]}return zv(a)}fillKeys(e,t,n){if(t.mdast.type===`yaml`)return;let r=this.parseInContext(e,t.start,t.end,n);t.keys=r?r.map(e=>this.keyOf(e)):null,t.node=r&&r.length===1?r[0]:null,t.nodes=r}coalesce(e,t,n){let r=!1;for(let i=t.length-2;i>=0;i--){let a=t[i],o=t[i+1];if(!a.keys?.length||!o.keys?.length||n[i]!==null||n[i+1]!==null)continue;let s=this.parseInContext(e,a.start,o.end,i===0);if(!s)continue;let c=s.map(e=>this.keyOf(e));Bv(c,[...a.keys,...o.keys])||(t.splice(i,2,{mdast:a.mdast,start:a.start,end:o.end,keys:c,node:s.length===1?s[0]:null,nodes:s}),r=!0)}return r}emitLevel(e,t,n,r,i){let a=t.map(e=>this.keyOf(e));n.forEach((t,n)=>this.fillKeys(e,t,n===0));let o=ny(n,a);if(!o||this.coalesce(e,n,o)&&(o=ny(n,a),!o))return null;Gv(n,t,o);let s=new Iv(this.source,n,r),c=[],l=0,u=e=>{for(let t=0;t<e;t++){let e=c[t];n[e].keys?.length===0&&s.verbatim(e)}},d=t=>{let i=t.type.name,a=c.findIndex(e=>{let t=n[e];return t.keys!==null&&t.keys.length>0&&t.node?.type.name===i});if(a===-1){s.canonical(this.renderCanonical(t,l,r),i);return}u(a);let o=c[a];c.splice(0,a+1);let d=this.tryRecurse(e,t,n[o],r)??this.tryPatchParagraph(e,t,n[o],o===0);d===null?s.canonical(this.renderCanonical(t,l,r),i):s.recursed(o,d,i)},f=e=>{for(;l<e;)d(t[l]),l++},p=()=>{u(c.length),c.length=0};i&&!i.omitted&&!i.hasYaml&&s.raw(i.canonical);for(let e=0;e<n.length;e++){let t=n[e];if(t.mdast.type===`yaml`){if(!i)return null;let n=i.appended===null?null:Wv(this.source.slice(t.start,t.end),i.appended,i.record);i.unchanged?s.verbatim(e):n===null?i.omitted||s.raw(i.canonical):s.recursed(e,n,`yaml`);continue}let r=o[e];r==null?c.push(e):(f(r),p(),l=r+t.keys.length,s.verbatim(e))}return f(t.length),p(),s.finish()}tryRecurse(e,t,n,r){let i=n.node;if(!i||i.type.name!==t.type.name)return null;let a=t.type.name;if(a===`table`)return this.emitTable(t,n);if(!Nv.has(a)&&!Mv.has(a)&&a!==`listItem`||a===O.customComponent&&t.attrs.name===`CodeBlock`)return null;let o=Mv.has(a)?`list`:a===`listItem`?`item`:`jsx`,s=o===`jsx`?this.resolveElement(n):n;if(!s)return null;let c=s.mdast.children;if(!c||c.length===0)return null;let l=this.buildSrcChildren(c);if(!l)return null;let u=l[0],d=l[l.length-1];if(u.start<s.start||d.end>s.end)return null;let f=this.source.slice(s.start,u.start),p=this.source.slice(d.end,s.end);if(this.shellKey(i)===this.shellKey(t)){if(!Kv(this.hollow(i),this.hollow(t)))return null}else{if(o!==`jsx`)return null;let e=$v(this.hollow(t),this.ser).split(`
86
86
  `)[0],n=f.split(`
87
- `)[0];if(!e.endsWith(`>`)||!/>[ \t]*$/.test(n)||n.slice(1).includes(`<`))return null;f=e+f.slice(n.trimEnd().length)}let m=this.linePrefix(u.start),h=this.linePrefix(s.start),g=o===`list`?this.listMarker(t,l):null;if(o===`list`&&!g)return null;let _=/^[ \t]*$/.test(h)?h:r.indent,v=o===`item`?this.continuationIndent([s]):null,y={kind:o,open:f,close:p,indent:v??(o===`jsx`&&!/^[ \t]*$/.test(m)?_+` `.repeat(this.ser.indentSize??2):m.replace(/\S/g,` `)),containerIndent:_,sepBody:this.separatorBody(l,o),list:g},b={outerOpen:e.outerOpen+e.innerOpen,innerOpen:f,close:p+e.close,chain:[...e.chain,a]};return this.emitLevel(b,Rv(t),l,y,null)}tryPatchParagraph(e,t,n,r){let i=n.node;if(!i||t.type.name!==`paragraph`||i.type.name!==`paragraph`||n.mdast.type!==`paragraph`||i.childCount!==t.childCount)return null;let a=-1;for(let e=0;e<t.childCount;e++){let n=i.child(e),r=t.child(e);if(!n.eq(r)){if(a!==-1||!n.isText||!r.isText||!n.sameMarkup(r))return null;a=e}}if(a===-1)return null;let o=t.child(a);if(o.marks.some(e=>e.type.name===`code`||e.type.name===`link`))return null;let s=Yv(n.mdast.children),c=s[a];if(s.length!==i.childCount||c?.type!==`text`)return null;let l=this.coords.span(c);if(!l||l.start<n.start||l.end>n.end)return null;let u=i.child(a).text,d=o.text,f=Zv(this.source,l.start,l.end,u);if(!f)return null;let p=0;for(;p<u.length&&p<d.length&&u[p]===d[p];)p++;let m=0;for(;m<u.length-p&&m<d.length-p&&u[u.length-1-m]===d[d.length-1-m];)m++;let h=new sg(this.ser).escRange(d,p,d.length-m),g=this.source.slice(n.start,f[p])+h+this.source.slice(f[u.length-m],n.end),_=this.parseText(e,g,n.start,r);return!_||_.length!==1||!Gv(_[0],t)?null:g}resolveElement(e){if(e.mdast.type===`mdxJsxFlowElement`||e.mdast.type===`mdxJsxTextElement`)return e;if(e.mdast.type!==`paragraph`)return null;let t=e.mdast.children.filter(e=>e.type!==`text`||e.value.trim()!==``),n=t[0];if(t.length!==1||n?.type!==`mdxJsxTextElement`)return null;let r=this.coords.span(n);return r?Object.assign(Object.assign({mdast:n},r),{keys:e.keys,node:e.node,nodes:e.nodes}):null}separatorBody(e,t){if(e.length>=2){let t=this.source.slice(e[0].end,e[1].start).match(/\n/g)?.length??0;if(t>=1)return t>=2?`
87
+ `)[0];if(!e.endsWith(`>`)||!/>[ \t]*$/.test(n)||n.slice(1).includes(`<`))return null;f=e+f.slice(n.trimEnd().length)}let m=this.linePrefix(u.start),h=this.linePrefix(s.start),g=o===`list`?this.listMarker(t,l):null;if(o===`list`&&!g)return null;let _=/^[ \t]*$/.test(h)?h:r.indent,v=o===`item`?this.continuationIndent([s]):null,y={kind:o,open:f,close:p,indent:v??(o===`jsx`&&!/^[ \t]*$/.test(m)?_+` `.repeat(this.ser.indentSize??2):m.replace(/\S/g,` `)),containerIndent:_,sepBody:this.separatorBody(l,o),list:g},b={outerOpen:e.outerOpen+e.innerOpen,innerOpen:f,close:p+e.close,chain:[...e.chain,a]};return this.emitLevel(b,zv(t),l,y,null)}tryPatchParagraph(e,t,n,r){let i=n.node;if(!i||t.type.name!==`paragraph`||i.type.name!==`paragraph`||n.mdast.type!==`paragraph`||i.childCount!==t.childCount)return null;let a=-1;for(let e=0;e<t.childCount;e++){let n=i.child(e),r=t.child(e);if(!n.eq(r)){if(a!==-1||!n.isText||!r.isText||!n.sameMarkup(r))return null;a=e}}if(a===-1)return null;let o=t.child(a);if(o.marks.some(e=>e.type.name===`code`||e.type.name===`link`))return null;let s=Xv(n.mdast.children),c=s[a];if(s.length!==i.childCount||c?.type!==`text`)return null;let l=this.coords.span(c);if(!l||l.start<n.start||l.end>n.end)return null;let u=i.child(a).text,d=o.text,f=Qv(this.source,l.start,l.end,u);if(!f)return null;let p=0;for(;p<u.length&&p<d.length&&u[p]===d[p];)p++;let m=0;for(;m<u.length-p&&m<d.length-p&&u[u.length-1-m]===d[d.length-1-m];)m++;let h=new cg(this.ser).escRange(d,p,d.length-m),g=this.source.slice(n.start,f[p])+h+this.source.slice(f[u.length-m],n.end),_=this.parseText(e,g,n.start,r);return!_||_.length!==1||!Kv(_[0],t)?null:g}resolveElement(e){if(e.mdast.type===`mdxJsxFlowElement`||e.mdast.type===`mdxJsxTextElement`)return e;if(e.mdast.type!==`paragraph`)return null;let t=e.mdast.children.filter(e=>e.type!==`text`||e.value.trim()!==``),n=t[0];if(t.length!==1||n?.type!==`mdxJsxTextElement`)return null;let r=this.coords.span(n);return r?Object.assign(Object.assign({mdast:n},r),{keys:e.keys,node:e.node,nodes:e.nodes}):null}separatorBody(e,t){if(e.length>=2){let t=this.source.slice(e[0].end,e[1].start).match(/\n/g)?.length??0;if(t>=1)return t>=2?`
88
88
 
89
89
  `:`
90
90
  `}return t===`list`||t===`item`?`
91
91
  `:`
92
92
 
93
- `}listMarker(e,t){let n=e.type.name===`orderedList`,r=[],i=n?`.`:`-`;for(let e of t){let t=kv.exec(this.source.slice(e.start,e.start+12));if(t){if(n!==(t[2]!==void 0))return null;i=n?t[3]:t[1],n&&r.push(Number(t[2]))}}let a=n&&r.length>=2&&r.every(e=>e===r[0])?r[0]:null;return{ordered:n,start:typeof e.attrs.start==`number`?e.attrs.start:1,delimiter:i,fixedNumber:a,contentIndent:this.continuationIndent(t)}}continuationIndent(e){for(let t of e){let e=t.mdast.children;if(!e||e.length<2)continue;let n=this.coords.span(e[1]);if(!n||this.coords.lineStart(n.start)<=t.start)continue;let r=this.linePrefix(n.start);if(/^[ \t]*$/.test(r))return r}return null}renderCanonical(e,t,n){if(!n.list)return Y_(e,this.ser,n.indent);let{list:r}=n,i=r.fixedNumber??r.start+t,a=e.attrs.checked,o=a==null?``:a?`[x] `:`[ ] `,s=(r.ordered?`${i}${r.delimiter} `:`${r.delimiter} `)+o,c=n.indent+` `.repeat(s.length),l=r.contentIndent&&r.contentIndent.length>=c.length?r.contentIndent:c;return s+Y_(e,this.ser,l)}emitTable(e,t){let n=t.node,r=t.mdast.children;if(!r||r.length===0||r.length!==n.childCount||e.childCount===0)return null;let i=this.buildSrcChildren(r);if(!i)return null;let a=n.child(0).childCount;for(let t=0;t<e.childCount;t++)if(e.child(t).childCount!==a)return null;let o=t=>this.keyOf(e.type.create(null,[t]));i.forEach((e,t)=>{e.keys=[o(n.child(t))]});let s=Lv(e),c=ty(i,s.map(o));if(!c||c[0]!==0&&c[0]!==null)return null;c.forEach((e,t)=>{e!==null&&!Gv(n.child(t),s[e])&&(c[t]=null)});let l=/* @__PURE__ */ new Map;if(c.forEach((e,t)=>{e!==null&&l.set(e,t)}),c[0]===null&&l.has(0))return null;let u=i[0],d=this.linePrefix(u.start).replace(/\S/g,` `),f=this.source.slice(u.end,i.length>=2?i[1].start:t.end),p=/^\n[^\n]*/.exec(f)?.[0];if(!p)return null;let m=u.end+p.length,h=this.source.slice(t.start,u.start);if(c[0]===0)h+=this.source.slice(u.start,u.end)+p;else{let t=Qv(e.type.create(null,[s[0]]),this.ser);h+=t.split(`
93
+ `}listMarker(e,t){let n=e.type.name===`orderedList`,r=[],i=n?`.`:`-`;for(let e of t){let t=Av.exec(this.source.slice(e.start,e.start+12));if(t){if(n!==(t[2]!==void 0))return null;i=n?t[3]:t[1],n&&r.push(Number(t[2]))}}let a=n&&r.length>=2&&r.every(e=>e===r[0])?r[0]:null;return{ordered:n,start:typeof e.attrs.start==`number`?e.attrs.start:1,delimiter:i,fixedNumber:a,contentIndent:this.continuationIndent(t)}}continuationIndent(e){for(let t of e){let e=t.mdast.children;if(!e||e.length<2)continue;let n=this.coords.span(e[1]);if(!n||this.coords.lineStart(n.start)<=t.start)continue;let r=this.linePrefix(n.start);if(/^[ \t]*$/.test(r))return r}return null}renderCanonical(e,t,n){if(!n.list)return X_(e,this.ser,n.indent);let{list:r}=n,i=r.fixedNumber??r.start+t,a=e.attrs.checked,o=a==null?``:a?`[x] `:`[ ] `,s=(r.ordered?`${i}${r.delimiter} `:`${r.delimiter} `)+o,c=n.indent+` `.repeat(s.length),l=r.contentIndent&&r.contentIndent.length>=c.length?r.contentIndent:c;return s+X_(e,this.ser,l)}emitTable(e,t){let n=t.node,r=t.mdast.children;if(!r||r.length===0||r.length!==n.childCount||e.childCount===0)return null;let i=this.buildSrcChildren(r);if(!i)return null;let a=n.child(0).childCount;for(let t=0;t<e.childCount;t++)if(e.child(t).childCount!==a)return null;let o=t=>this.keyOf(e.type.create(null,[t]));i.forEach((e,t)=>{e.keys=[o(n.child(t))]});let s=Rv(e),c=ny(i,s.map(o));if(!c||c[0]!==0&&c[0]!==null)return null;c.forEach((e,t)=>{e!==null&&!Kv(n.child(t),s[e])&&(c[t]=null)});let l=/* @__PURE__ */ new Map;if(c.forEach((e,t)=>{e!==null&&l.set(e,t)}),c[0]===null&&l.has(0))return null;let u=i[0],d=this.linePrefix(u.start).replace(/\S/g,` `),f=this.source.slice(u.end,i.length>=2?i[1].start:t.end),p=/^\n[^\n]*/.exec(f)?.[0];if(!p)return null;let m=u.end+p.length,h=this.source.slice(t.start,u.start);if(c[0]===0)h+=this.source.slice(u.start,u.end)+p;else{let t=$v(e.type.create(null,[s[0]]),this.ser);h+=t.split(`
94
94
  `).slice(0,2).join(`
95
95
  ${d}`)}let g=null;for(let t=1;t<s.length;t++){let n=l.get(t);n!==void 0&&t===1&&n===1?h+=this.source.slice(m,i[1].start):n!==void 0&&g!==null&&n===g+1?h+=this.source.slice(i[g].end,i[n].start):h+=`
96
- ${d}`,n===void 0?(h+=Qv(e.type.create(null,[s[t]]),this.ser).split(`
97
- `)[0],g=null):(h+=this.source.slice(i[n].start,i[n].end),g=n)}return i.length>=2&&g===i.length-1&&(h+=this.source.slice(i[g].end,t.end)),h}shellKey(e){let t=e.type.name;return`${t}|${jv.has(t)||t===`listItem`?JSON.stringify(e.attrs):``}|${Qv(this.hollow(e),this.ser)}`}hollow(e){let t=e.type.name;if(Av.has(t)&&e.childCount>=2)return e.copy(ye.from([e.child(0),e.child(1).copy(ye.from(this.emptyParagraph))]));if(jv.has(t)){let t=this.schema.nodes.listItem.create(null,this.emptyParagraph);return e.copy(ye.from(t))}return e.copy(ye.from(this.emptyParagraph))}};function Lv(e){let t=[];return e.forEach(e=>t.push(e)),t}function Rv(e){if(Av.has(e.type.name))return e.childCount>=2?Lv(e.child(1)):[];let t=Lv(e);return rv(e)?t.slice(1):t}function zv(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Bv(e){return new Map(Object.entries(wh(e)).map(([e,t])=>[e,Ih(e,t)]))}function Vv(e,t){let n=Bv(e),r=Bv(t);for(let[e,t]of n)if(r.get(e)!==t)return{kind:`rewrite`};let i=[...r].filter(([e])=>!n.has(e)).map(([,e])=>e);return i.length===0?{kind:`same`}:{kind:`append`,lines:i.join(`
98
- `)}}function Hv(e,t){let n=/(\r?\n)---[ \t]*$/.exec(e);if(!n)return null;let r=n[1];return`${e.slice(0,n.index)}${r}${t.replace(/\n/g,r)}${e.slice(n.index)}`}function Uv(e,t,n){let r=Hv(e,t);if(r===null||n===void 0)return null;let i=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*$/.exec(r)?.[1];if(i===void 0)return null;let a;try{a=(0,ae.parse)(i)}catch{return null}if(!a||typeof a!=`object`||Array.isArray(a))return null;let o=Bv(a),s=Bv(n);if(o.size!==s.size)return null;for(let[e,t]of s)if(o.get(e)!==t)return null;return r}function Wv(e,t,n){n.forEach((r,i)=>{if(r===null)return;let a=e[i].nodes;(!a||a.some((e,n)=>!Gv(e,t[r+n])))&&(n[i]=null)})}function Gv(e,t){return e.eq(t)||uv(e.toJSON(),t.toJSON())}function Kv(e){if(e.type!==`paragraph`)return[e];let t=e.children.filter(e=>e.type!==`text`||e.value.trim()!==``);return t.length>0&&t.every(e=>e.type===`mdxJsxTextElement`&&Kp(e.name))?t:[e]}var qv=/* @__PURE__ */ new Set([`emphasis`,`strong`,`delete`,`link`]),Jv=/* @__PURE__ */ new Set([`u`,`sub`,`sup`]);function Yv(e){let t=[];for(let n of e)qv.has(n.type)&&`children`in n||n.type===`mdxJsxTextElement`&&n.name!==null&&Jv.has(n.name)?t.push(...Yv(n.children)):t.push(n);return t}var Xv=/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/;function Zv(e,t,n,r){let i=[],a=t;for(let t=0;t<r.length;t++){if(i.push(a),a>=n)return null;let o=/^[ \t]*\n[ \t\n]*/.exec(e.slice(a,n));if(o){if(r[t]!==` `)return null;a+=o[0].length}else{if(e[a]===`\\`&&a+1<n&&Xv.test(e[a+1])&&a++,e[a]!==r[t])return null;a++}}return i.push(a),/^[ \t]*$/.test(e.slice(a,n))?i:null}function Qv(e,t){try{return J_(e.type.schema.topNodeType.create(null,[e]),Object.assign(Object.assign({},t),{removeTrailingNewline:!0}))}catch{return JSON.stringify(e.toJSON())}}function $v(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
99
- `&&t.push(n+1);return t}function ey(e,t){let n=e.split(`
96
+ ${d}`,n===void 0?(h+=$v(e.type.create(null,[s[t]]),this.ser).split(`
97
+ `)[0],g=null):(h+=this.source.slice(i[n].start,i[n].end),g=n)}return i.length>=2&&g===i.length-1&&(h+=this.source.slice(i[g].end,t.end)),h}shellKey(e){let t=e.type.name;return`${t}|${Mv.has(t)||t===`listItem`?JSON.stringify(e.attrs):``}|${$v(this.hollow(e),this.ser)}`}hollow(e){let t=e.type.name;if(jv.has(t)&&e.childCount>=2)return e.copy(ye.from([e.child(0),e.child(1).copy(ye.from(this.emptyParagraph))]));if(Mv.has(t)){let t=this.schema.nodes.listItem.create(null,this.emptyParagraph);return e.copy(ye.from(t))}return e.copy(ye.from(this.emptyParagraph))}};function Rv(e){let t=[];return e.forEach(e=>t.push(e)),t}function zv(e){if(jv.has(e.type.name))return e.childCount>=2?Rv(e.child(1)):[];let t=Rv(e);return iv(e)?t.slice(1):t}function Bv(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Vv(e){return new Map(Object.entries(wh(e)).map(([e,t])=>[e,Ih(e,t)]))}function Hv(e,t){let n=Vv(e),r=Vv(t);for(let[e,t]of n)if(r.get(e)!==t)return{kind:`rewrite`};let i=[...r].filter(([e])=>!n.has(e)).map(([,e])=>e);return i.length===0?{kind:`same`}:{kind:`append`,lines:i.join(`
98
+ `)}}function Uv(e,t){let n=/(\r?\n)---[ \t]*$/.exec(e);if(!n)return null;let r=n[1];return`${e.slice(0,n.index)}${r}${t.replace(/\n/g,r)}${e.slice(n.index)}`}function Wv(e,t,n){let r=Uv(e,t);if(r===null||n===void 0)return null;let i=/^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*$/.exec(r)?.[1];if(i===void 0)return null;let a;try{a=(0,ae.parse)(i)}catch{return null}if(!a||typeof a!=`object`||Array.isArray(a))return null;let o=Vv(a),s=Vv(n);if(o.size!==s.size)return null;for(let[e,t]of s)if(o.get(e)!==t)return null;return r}function Gv(e,t,n){n.forEach((r,i)=>{if(r===null)return;let a=e[i].nodes;(!a||a.some((e,n)=>!Kv(e,t[r+n])))&&(n[i]=null)})}function Kv(e,t){return e.eq(t)||dv(e.toJSON(),t.toJSON())}function qv(e){if(e.type!==`paragraph`)return[e];let t=e.children.filter(e=>e.type!==`text`||e.value.trim()!==``);return t.length>0&&t.every(e=>e.type===`mdxJsxTextElement`&&Kp(e.name))?t:[e]}var Jv=/* @__PURE__ */ new Set([`emphasis`,`strong`,`delete`,`link`]),Yv=/* @__PURE__ */ new Set([`u`,`sub`,`sup`]);function Xv(e){let t=[];for(let n of e)Jv.has(n.type)&&`children`in n||n.type===`mdxJsxTextElement`&&n.name!==null&&Yv.has(n.name)?t.push(...Xv(n.children)):t.push(n);return t}var Zv=/[!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~]/;function Qv(e,t,n,r){let i=[],a=t;for(let t=0;t<r.length;t++){if(i.push(a),a>=n)return null;let o=/^[ \t]*\n[ \t\n]*/.exec(e.slice(a,n));if(o){if(r[t]!==` `)return null;a+=o[0].length}else{if(e[a]===`\\`&&a+1<n&&Zv.test(e[a+1])&&a++,e[a]!==r[t])return null;a++}}return i.push(a),/^[ \t]*$/.test(e.slice(a,n))?i:null}function $v(e,t){try{return Y_(e.type.schema.topNodeType.create(null,[e]),Object.assign(Object.assign({},t),{removeTrailingNewline:!0}))}catch{return JSON.stringify(e.toJSON())}}function ey(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
99
+ `&&t.push(n+1);return t}function ty(e,t){let n=e.split(`
100
100
  `),r=t.split(`
101
- `),i=[],a=0;for(let e=0;e<r.length;)if(r[e]===n[a])i.push(a),a++,e++;else if(Ev.test(r[e]??``)&&Dv.test(r[e+2]??``))i.push(a,a,a),a++,e+=3;else return null;return a===n.length?i:null}function ty(e,t){let n=[];e.forEach((e,t)=>{e.keys&&e.keys.length>0&&n.push(t)});let r=n.length,i=t.length;if((r+1)*(i+1)>Ov)return null;let a=(e,n)=>{if(n+e.length>i)return!1;for(let r=0;r<e.length;r++)if(t[n+r]!==e[r])return!1;return!0},o=Array.from({length:r+1},()=>new Int32Array(i+1));for(let t=r-1;t>=0;t--){let r=e[n[t]].keys,s=o[t],c=o[t+1];for(let e=i-1;e>=0;e--){let t=Math.max(c[e],s[e+1]);a(r,e)&&(t=Math.max(t,r.length+c[e+r.length])),s[e]=t}}let s=e.map(()=>null),c=0,l=0;for(;c<r&&l<i;){let t=e[n[c]].keys;a(t,l)&&o[c][l]===t.length+o[c+1][l+t.length]?(s[n[c]]=l,c++,l+=t.length):o[c][l]===o[c+1][l]?c++:l++}return s}function ny(e,t){throw Error(`pmJsonToMdast is not yet implemented — use pmToMdx instead for direct MDX output`)}function ry(e){let t=o().use(x).use(b).use(a).use(r).stringify(e);return typeof t==`string`?t:String(t)}var iy=(e,t,n)=>uv(e,t)?[]:ly(ay(e.content??[],t.content??[],0,n)),ay=(e,t,n,r)=>{let i=0,a=Math.min(e.length,t.length);for(;i<a&&uv(e[i],t[i]);)i++;if(i===e.length&&i===t.length)return[];let o=0;for(;o<a-i&&uv(e[e.length-1-o],t[t.length-1-o]);)o++;let s=e.slice(i,e.length-o),c=t.slice(i,t.length-o),l=0;for(let t=0;t<i;t++)l+=vv(e[t],r);let u=n+l;if(s.length===0&&c.length===0)return[];if(s.length===0)return[{from:u,to:u,insert:c}];if(c.length===0){let e=0;for(let t of s)e+=vv(t,r);return[{from:u,to:u+e,insert:[]}]}return oy(cy(s,c,r),s,c,u,r)},oy=(e,t,n,r,i)=>{let a=[],o=[],s=0;for(let e of t)o.push(s),s+=vv(e,i);let c=0;for(;c<e.length;){let s=e[c];if(s.type===`matched`){let e=t[s.oldIdx],l=n[s.newIdx];if(uv(e,l)){c++;continue}let u=r+o[s.oldIdx],d=sy(e,l,u,i);if(d)a.push(...d);else{let t=vv(e,i);a.push({from:u,to:u+t,insert:[l]})}c++;continue}let l=c,u=[],d=[];for(;c<e.length&&e[c].type!==`matched`;){let t=e[c];t.type===`deleted`?u.push(t.oldIdx):t.type===`inserted`&&d.push(n[t.newIdx]),c++}if(u.length===0&&d.length===0)continue;let f,p;if(u.length>0){let e=u[0],n=u[u.length-1];f=r+o[e],p=r+o[n]+vv(t[n],i)}else{let n=l>0?e[l-1]:void 0;f=n?.type===`matched`?r+o[n.oldIdx]+vv(t[n.oldIdx],i):r,p=f}a.push({from:f,to:p,insert:d})}return a.sort((e,t)=>t.from-e.from),a},sy=(e,t,n,r)=>{if(e.type!==t.type||Cv(e.type,r)||Sv(e.type,r))return null;let i=e.content??[],a=t.content??[];if(!dv(e.attrs,t.attrs))return null;let o=ay(i,a,n+1,r);return o.length===0?null:o},cy=(e,t,n)=>{let r=e.length,i=t.length,a=Array.from({length:r+1},()=>Array(i+1).fill(0)),o=(e,t)=>a[e]?.[t]??0;for(let s=1;s<=r;s++){let r=a[s];for(let a=1;a<=i;a++)xv(e[s-1],t[a-1],n)?r[a]=o(s-1,a-1)+1:r[a]=Math.max(o(s-1,a),o(s,a-1))}let s=[],c=r,l=i;for(;c>0||l>0;)c>0&&l>0&&xv(e[c-1],t[l-1],n)&&o(c,l-1)<o(c,l)?(s.push({type:`matched`,oldIdx:c-1,newIdx:l-1}),c--,l--):l>0&&(c===0||o(c,l-1)>=o(c-1,l))?(s.push({type:`inserted`,newIdx:l-1}),l--):(s.push({type:`deleted`,oldIdx:c-1}),c--);return s.reverse(),s},ly=e=>{if(e.length<=1)return e;e.sort((e,t)=>e.from-t.from);let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];r.to===i.from?t[t.length-1]={from:r.from,to:i.to,insert:[...r.insert,...i.insert]}:t.push(i)}return t.sort((e,t)=>t.from-e.from),t};function uy(e){return Object.assign(Object.assign({},e),{attrs:e.attrs?Object.assign({},e.attrs):void 0,marks:e.marks?.map(e=>Object.assign(Object.assign({},e),{attrs:e.attrs?Object.assign({},e.attrs):void 0})),content:e.content?.map(e=>uy(e))})}function dy(e){return Object.assign({type:e.type,attrs:e.attrs?Object.assign({},e.attrs):void 0,marks:e.marks?.map(e=>Object.assign(Object.assign({},e),{attrs:e.attrs?Object.assign({},e.attrs):void 0}))},e.text==null?{}:{text:e.text})}function fy(e,t){return bv(yv(e),yv(t))}function py(e,t,n){if(uv(e,t))return 1e4;if(!xv(e,t,n))return-1/0;let r=100;return dv(e.attrs,t.attrs)&&(r+=25),r+=fy(e,t),r}function my(e,t,n,r){let i=null,a=-1/0;for(let o=n;o<t.length;o+=1){let s=t[o];if(!s)continue;let c=py(e,s,r);if(!Number.isFinite(c))continue;let l=c-(o-n)*.1;if(l>a&&(a=l,i=o),c>=1e4)break}return i}function hy(e,t,n){return{node:uy(e),annotations:[Object.assign({path:[],type:t},n?{hunk:n}:{})]}}function gy(e,t,n){return{baseNode:e?uy(e):null,localNode:t?uy(t):null,remoteNode:n?uy(n):null}}function _y(e){return e.reduce((e,t)=>({appliedCount:e.appliedCount+ +(t.type===`applied`),conflictCount:e.conflictCount+ +(t.type===`conflict`)}),{appliedCount:0,conflictCount:0})}function vy(e,t){return e.map(e=>Object.assign({path:[t,...e.path],type:e.type},e.hunk?{hunk:e.hunk}:{}))}function yy(e,t,n){let r=t.content?.map(e=>uy(e))??[],i=n.content?.map(e=>uy(e))??[],a=yv(t),o=yv(n);if(a.length>0&&o.length>0){if(o.length>a.length&&o.includes(a))return{node:Object.assign(Object.assign({},dy(n)),{content:i}),annotations:[{path:[],type:`applied`}]};if(a.length>o.length&&a.includes(o))return{node:Object.assign(Object.assign({},dy(t)),{content:r}),annotations:[]}}let s=r.length>0&&i.length>0&&yv(t).length>0&&yv(n).length>0?[...r,{type:`text`,text:` `},...i]:[...r,...i];return{node:Object.assign(Object.assign({},dy(t)),{content:s}),annotations:[{path:[],type:`conflict`,hunk:gy(e,t,n)}]}}function by(e,t,n,r){if(!t&&!n)return[];if(!t)return!n||uv(e,n)?[]:[hy(n,`conflict`,gy(e,null,n))];if(!n)return uv(e,t)?[]:[hy(t,`conflict`,gy(e,t,null))];let i=!uv(e,t),a=!uv(e,n);if(!i&&!a)return[{node:uy(t),annotations:[]}];if(!i&&a)return[hy(n,`applied`)];if(i&&!a||uv(t,n))return[{node:uy(t),annotations:[]}];if(t.type===n.type&&t.type===e.type&&dv(t.attrs,n.attrs)&&dv(e.attrs,t.attrs)){if(Sv(t.type,r)&&!wv(t.type,r))return[yy(e,t,n)];if(!Cv(t.type,r)&&!wv(t.type,r)&&t.content&&n.content&&e.content){let i=Dy(e.content,t.content,n.content,r);return[{node:Object.assign(Object.assign({},dy(t)),{content:i.nodes}),annotations:i.annotations.map(e=>Object.assign({path:e.path,type:e.type},e.hunk?{hunk:e.hunk}:{}))}]}}return[{node:uy(t),annotations:[]},hy(n,`conflict`,gy(e,t,n))]}function xy(e,t,n){let r=[],i=0;for(let a of e){let e=my(a,t,i,n);r.push(e),e!=null&&(i=e+1)}return r}function Sy(e,t){return Array.from({length:e},()=>Array(t).fill(0))}function Cy(e,t,n){let r=n.get(e);if(r!==void 0)return r;let i;try{i=J_(t.nodeFromJSON({type:`doc`,content:[e]}))}catch{i=JSON.stringify(e)}return n.set(e,i),i}function wy(e,t,n,r){return uv(e,t)?!0:Cy(e,n,r)===Cy(t,n,r)}function Ty(e,t,n,r){let i=Sy(e.length+1,t.length+1);for(let a=e.length-1;a>=0;--a){let o=e[a],s=i[a],c=i[a+1];for(let e=t.length-1;e>=0;--e){let i=t[e],a=c[e],l=s[e+1];if(wy(o,i,n,r)){let t=c[e+1]+1;s[e]=t}else s[e]=Math.max(a,l)}}return i}function Ey(e,t,n){return(e[t+1]?.[n]??0)>=(e[t]?.[n+1]??0)}function Dy(e,t,n,r){let i=[],a=[],o=/* @__PURE__ */ new Map,s=xy(e,t,r),c=xy(e,n,r),l=e=>{let t=i.length;i.push(e.node),a.push(...vy(e.annotations,t))},u=(e,n)=>{for(let r=e;r<n;r+=1){let e=t[r];e&&l({node:uy(e),annotations:[]})}},d=(e,t,r)=>{for(let i=e;i<t;i+=1){let e=n[i];e&&l(hy(e,r))}},f=(e,i,a,s)=>{let c=t.slice(e,i),f=n.slice(a,s);if(c.length===0){d(a,s,`applied`);return}if(f.length===0){u(e,i);return}let p=Ty(c,f,r,o),m=0,h=0;for(;m<c.length&&h<f.length;){let e=c[m],t=f[h];e&&t&&wy(e,t,r,o)?(l({node:uy(e),annotations:[]}),m+=1,h+=1):Ey(p,m,h)?(l({node:uy(e),annotations:[]}),m+=1):(l(hy(t,`applied`)),h+=1)}u(e+m,i),d(a+h,s,`applied`)},p=0,m=0;for(let i=0;i<e.length;i+=1){let a=e[i],o=s[i]??null,u=c[i]??null;f(p,o??p,m,u??m);let d=o==null?void 0:t[o],h=u==null?void 0:n[u];for(let e of by(a,d,h,r))l(e);o!=null&&(p=o+1),u!=null&&(m=u+1)}return f(p,t.length,m,n.length),{nodes:i,annotations:a}}function Oy(e){let{baseDoc:t,localDoc:n,remoteDoc:r,schema:i}=e,a=Dy(t.content??[],n.content??[],r.content??[],i),o=!dv(t.attrs,n.attrs),s=!dv(t.attrs,r.attrs),c=Object.assign(Object.assign({},dy(!o&&s?r:n)),{content:a.nodes}),l=[],u=a.annotations.map(e=>(e.type===`conflict`&&e.hunk&&l.push(Object.assign({path:e.path},e.hunk)),{path:e.path,type:e.type}));return{mergedDoc:c,annotations:u,conflicts:l,summary:_y(u)}}export{O as BLOCK_TYPES,wt as CALLOUT_TYPES,Ot as COMMENT_THREAD_IDS_ATTR,k as DEFAULT_CODE_BLOCK_LANGUAGE,Sn as DEFAULT_DATABASE_VIEW,Ft as DEFAULT_MERMAID_PLACEMENT,Et as EDITOR_COMPONENT_NAMES,kh as FRONTMATTER_ATTRIBUTES_WITH_ARRAY_VALUES,Oh as FRONTMATTER_ATTRIBUTES_WITH_BOOLEAN_VALUES,jt as HIDDEN_NODE_ATTRS,Tt as HTML_ELEMENTS,Pt as IMAGE_ALIGN_CLASSES,dv as attrsEqual,H_ as canonicalPmToMdxOptions,xn as createSchema,uv as deepEqual,iy as diffDocs,Am as extractDiffMarkers,Un as extractFrontmatter,yv as extractText,wh as filterFrontmatterRecord,Vn as findRedundantStaticHtmlSources,Ih as formatFrontmatterValue,Mm as formatLineRanges,Nm as getDiffMarkerComment,mp as getImageAlignFromClassName,hp as getImageWidthFromStyle,wn as isDatabaseId,Tn as isDatabaseView,Lh as isJSXContent,Ch as isNonEmptyFrontmatterValue,Sh as mdToPm,ry as mdastToMdx,Gm as mdastToPm,$f as mdxToMdast,$m as mdxToPm,Oy as mergeRemoteIntoLiveDoc,bn as mintlifySchema,vv as nodeSize,xv as nodesMatch,Ln as parseCommentThreadIds,sp as parseExpressionAttribute,Hn as parseFrontmatterYaml,jm as parseLineRanges,$ as parseMdxAttributes,km as parseMetaString,ny as pmJsonToMdast,J_ as pmToMdx,Nv as pmToMdxPreservingSource,Fn as readDatabaseSql,En as resolveDatabaseView,Ah as safeJsonParse,lp as sanitizeDomAttrs,Rn as serializeCommentThreadIds,Mn as serializeDatabaseSql,Bh as serializePropValue,iv as startsWithPlaceholderParagraph,Mh as storedValueToTyped,bv as textSimilarity};
101
+ `),i=[],a=0;for(let e=0;e<r.length;)if(r[e]===n[a])i.push(a),a++,e++;else if(Dv.test(r[e]??``)&&Ov.test(r[e+2]??``))i.push(a,a,a),a++,e+=3;else return null;return a===n.length?i:null}function ny(e,t){let n=[];e.forEach((e,t)=>{e.keys&&e.keys.length>0&&n.push(t)});let r=n.length,i=t.length;if((r+1)*(i+1)>kv)return null;let a=(e,n)=>{if(n+e.length>i)return!1;for(let r=0;r<e.length;r++)if(t[n+r]!==e[r])return!1;return!0},o=Array.from({length:r+1},()=>new Int32Array(i+1));for(let t=r-1;t>=0;t--){let r=e[n[t]].keys,s=o[t],c=o[t+1];for(let e=i-1;e>=0;e--){let t=Math.max(c[e],s[e+1]);a(r,e)&&(t=Math.max(t,r.length+c[e+r.length])),s[e]=t}}let s=e.map(()=>null),c=0,l=0;for(;c<r&&l<i;){let t=e[n[c]].keys;a(t,l)&&o[c][l]===t.length+o[c+1][l+t.length]?(s[n[c]]=l,c++,l+=t.length):o[c][l]===o[c+1][l]?c++:l++}return s}function ry(e,t){throw Error(`pmJsonToMdast is not yet implemented — use pmToMdx instead for direct MDX output`)}function iy(e){let t=o().use(x).use(b).use(a).use(r).stringify(e);return typeof t==`string`?t:String(t)}var ay=(e,t,n)=>dv(e,t)?[]:uy(oy(e.content??[],t.content??[],0,n)),oy=(e,t,n,r)=>{let i=0,a=Math.min(e.length,t.length);for(;i<a&&dv(e[i],t[i]);)i++;if(i===e.length&&i===t.length)return[];let o=0;for(;o<a-i&&dv(e[e.length-1-o],t[t.length-1-o]);)o++;let s=e.slice(i,e.length-o),c=t.slice(i,t.length-o),l=0;for(let t=0;t<i;t++)l+=yv(e[t],r);let u=n+l;if(s.length===0&&c.length===0)return[];if(s.length===0)return[{from:u,to:u,insert:c}];if(c.length===0){let e=0;for(let t of s)e+=yv(t,r);return[{from:u,to:u+e,insert:[]}]}return sy(ly(s,c,r),s,c,u,r)},sy=(e,t,n,r,i)=>{let a=[],o=[],s=0;for(let e of t)o.push(s),s+=yv(e,i);let c=0;for(;c<e.length;){let s=e[c];if(s.type===`matched`){let e=t[s.oldIdx],l=n[s.newIdx];if(dv(e,l)){c++;continue}let u=r+o[s.oldIdx],d=cy(e,l,u,i);if(d)a.push(...d);else{let t=yv(e,i);a.push({from:u,to:u+t,insert:[l]})}c++;continue}let l=c,u=[],d=[];for(;c<e.length&&e[c].type!==`matched`;){let t=e[c];t.type===`deleted`?u.push(t.oldIdx):t.type===`inserted`&&d.push(n[t.newIdx]),c++}if(u.length===0&&d.length===0)continue;let f,p;if(u.length>0){let e=u[0],n=u[u.length-1];f=r+o[e],p=r+o[n]+yv(t[n],i)}else{let n=l>0?e[l-1]:void 0;f=n?.type===`matched`?r+o[n.oldIdx]+yv(t[n.oldIdx],i):r,p=f}a.push({from:f,to:p,insert:d})}return a.sort((e,t)=>t.from-e.from),a},cy=(e,t,n,r)=>{if(e.type!==t.type||wv(e.type,r)||Cv(e.type,r))return null;let i=e.content??[],a=t.content??[];if(!fv(e.attrs,t.attrs))return null;let o=oy(i,a,n+1,r);return o.length===0?null:o},ly=(e,t,n)=>{let r=e.length,i=t.length,a=Array.from({length:r+1},()=>Array(i+1).fill(0)),o=(e,t)=>a[e]?.[t]??0;for(let s=1;s<=r;s++){let r=a[s];for(let a=1;a<=i;a++)Sv(e[s-1],t[a-1],n)?r[a]=o(s-1,a-1)+1:r[a]=Math.max(o(s-1,a),o(s,a-1))}let s=[],c=r,l=i;for(;c>0||l>0;)c>0&&l>0&&Sv(e[c-1],t[l-1],n)&&o(c,l-1)<o(c,l)?(s.push({type:`matched`,oldIdx:c-1,newIdx:l-1}),c--,l--):l>0&&(c===0||o(c,l-1)>=o(c-1,l))?(s.push({type:`inserted`,newIdx:l-1}),l--):(s.push({type:`deleted`,oldIdx:c-1}),c--);return s.reverse(),s},uy=e=>{if(e.length<=1)return e;e.sort((e,t)=>e.from-t.from);let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];r.to===i.from?t[t.length-1]={from:r.from,to:i.to,insert:[...r.insert,...i.insert]}:t.push(i)}return t.sort((e,t)=>t.from-e.from),t};function dy(e){return Object.assign(Object.assign({},e),{attrs:e.attrs?Object.assign({},e.attrs):void 0,marks:e.marks?.map(e=>Object.assign(Object.assign({},e),{attrs:e.attrs?Object.assign({},e.attrs):void 0})),content:e.content?.map(e=>dy(e))})}function fy(e){return Object.assign({type:e.type,attrs:e.attrs?Object.assign({},e.attrs):void 0,marks:e.marks?.map(e=>Object.assign(Object.assign({},e),{attrs:e.attrs?Object.assign({},e.attrs):void 0}))},e.text==null?{}:{text:e.text})}function py(e,t){return xv(bv(e),bv(t))}function my(e,t,n){if(dv(e,t))return 1e4;if(!Sv(e,t,n))return-1/0;let r=100;return fv(e.attrs,t.attrs)&&(r+=25),r+=py(e,t),r}function hy(e,t,n,r){let i=null,a=-1/0;for(let o=n;o<t.length;o+=1){let s=t[o];if(!s)continue;let c=my(e,s,r);if(!Number.isFinite(c))continue;let l=c-(o-n)*.1;if(l>a&&(a=l,i=o),c>=1e4)break}return i}function gy(e,t,n){return{node:dy(e),annotations:[Object.assign({path:[],type:t},n?{hunk:n}:{})]}}function _y(e,t,n){return{baseNode:e?dy(e):null,localNode:t?dy(t):null,remoteNode:n?dy(n):null}}function vy(e){return e.reduce((e,t)=>({appliedCount:e.appliedCount+ +(t.type===`applied`),conflictCount:e.conflictCount+ +(t.type===`conflict`)}),{appliedCount:0,conflictCount:0})}function yy(e,t){return e.map(e=>Object.assign({path:[t,...e.path],type:e.type},e.hunk?{hunk:e.hunk}:{}))}function by(e,t,n){let r=t.content?.map(e=>dy(e))??[],i=n.content?.map(e=>dy(e))??[],a=bv(t),o=bv(n);if(a.length>0&&o.length>0){if(o.length>a.length&&o.includes(a))return{node:Object.assign(Object.assign({},fy(n)),{content:i}),annotations:[{path:[],type:`applied`}]};if(a.length>o.length&&a.includes(o))return{node:Object.assign(Object.assign({},fy(t)),{content:r}),annotations:[]}}let s=r.length>0&&i.length>0&&bv(t).length>0&&bv(n).length>0?[...r,{type:`text`,text:` `},...i]:[...r,...i];return{node:Object.assign(Object.assign({},fy(t)),{content:s}),annotations:[{path:[],type:`conflict`,hunk:_y(e,t,n)}]}}function xy(e,t,n,r){if(!t&&!n)return[];if(!t)return!n||dv(e,n)?[]:[gy(n,`conflict`,_y(e,null,n))];if(!n)return dv(e,t)?[]:[gy(t,`conflict`,_y(e,t,null))];let i=!dv(e,t),a=!dv(e,n);if(!i&&!a)return[{node:dy(t),annotations:[]}];if(!i&&a)return[gy(n,`applied`)];if(i&&!a||dv(t,n))return[{node:dy(t),annotations:[]}];if(t.type===n.type&&t.type===e.type&&fv(t.attrs,n.attrs)&&fv(e.attrs,t.attrs)){if(Cv(t.type,r)&&!Tv(t.type,r))return[by(e,t,n)];if(!wv(t.type,r)&&!Tv(t.type,r)&&t.content&&n.content&&e.content){let i=Oy(e.content,t.content,n.content,r);return[{node:Object.assign(Object.assign({},fy(t)),{content:i.nodes}),annotations:i.annotations.map(e=>Object.assign({path:e.path,type:e.type},e.hunk?{hunk:e.hunk}:{}))}]}}return[{node:dy(t),annotations:[]},gy(n,`conflict`,_y(e,t,n))]}function Sy(e,t,n){let r=[],i=0;for(let a of e){let e=hy(a,t,i,n);r.push(e),e!=null&&(i=e+1)}return r}function Cy(e,t){return Array.from({length:e},()=>Array(t).fill(0))}function wy(e,t,n){let r=n.get(e);if(r!==void 0)return r;let i;try{i=Y_(t.nodeFromJSON({type:`doc`,content:[e]}))}catch{i=JSON.stringify(e)}return n.set(e,i),i}function Ty(e,t,n,r){return dv(e,t)?!0:wy(e,n,r)===wy(t,n,r)}function Ey(e,t,n,r){let i=Cy(e.length+1,t.length+1);for(let a=e.length-1;a>=0;--a){let o=e[a],s=i[a],c=i[a+1];for(let e=t.length-1;e>=0;--e){let i=t[e],a=c[e],l=s[e+1];if(Ty(o,i,n,r)){let t=c[e+1]+1;s[e]=t}else s[e]=Math.max(a,l)}}return i}function Dy(e,t,n){return(e[t+1]?.[n]??0)>=(e[t]?.[n+1]??0)}function Oy(e,t,n,r){let i=[],a=[],o=/* @__PURE__ */ new Map,s=Sy(e,t,r),c=Sy(e,n,r),l=e=>{let t=i.length;i.push(e.node),a.push(...yy(e.annotations,t))},u=(e,n)=>{for(let r=e;r<n;r+=1){let e=t[r];e&&l({node:dy(e),annotations:[]})}},d=(e,t,r)=>{for(let i=e;i<t;i+=1){let e=n[i];e&&l(gy(e,r))}},f=(e,i,a,s)=>{let c=t.slice(e,i),f=n.slice(a,s);if(c.length===0){d(a,s,`applied`);return}if(f.length===0){u(e,i);return}let p=Ey(c,f,r,o),m=0,h=0;for(;m<c.length&&h<f.length;){let e=c[m],t=f[h];e&&t&&Ty(e,t,r,o)?(l({node:dy(e),annotations:[]}),m+=1,h+=1):Dy(p,m,h)?(l({node:dy(e),annotations:[]}),m+=1):(l(gy(t,`applied`)),h+=1)}u(e+m,i),d(a+h,s,`applied`)},p=0,m=0;for(let i=0;i<e.length;i+=1){let a=e[i],o=s[i]??null,u=c[i]??null;f(p,o??p,m,u??m);let d=o==null?void 0:t[o],h=u==null?void 0:n[u];for(let e of xy(a,d,h,r))l(e);o!=null&&(p=o+1),u!=null&&(m=u+1)}return f(p,t.length,m,n.length),{nodes:i,annotations:a}}function ky(e){let{baseDoc:t,localDoc:n,remoteDoc:r,schema:i}=e,a=Oy(t.content??[],n.content??[],r.content??[],i),o=!fv(t.attrs,n.attrs),s=!fv(t.attrs,r.attrs),c=Object.assign(Object.assign({},fy(!o&&s?r:n)),{content:a.nodes}),l=[],u=a.annotations.map(e=>(e.type===`conflict`&&e.hunk&&l.push(Object.assign({path:e.path},e.hunk)),{path:e.path,type:e.type}));return{mergedDoc:c,annotations:u,conflicts:l,summary:vy(u)}}export{O as BLOCK_TYPES,wt as CALLOUT_TYPES,Ot as COMMENT_THREAD_IDS_ATTR,k as DEFAULT_CODE_BLOCK_LANGUAGE,Sn as DEFAULT_DATABASE_VIEW,Ft as DEFAULT_MERMAID_PLACEMENT,Et as EDITOR_COMPONENT_NAMES,kh as FRONTMATTER_ATTRIBUTES_WITH_ARRAY_VALUES,Oh as FRONTMATTER_ATTRIBUTES_WITH_BOOLEAN_VALUES,jt as HIDDEN_NODE_ATTRS,Tt as HTML_ELEMENTS,Pt as IMAGE_ALIGN_CLASSES,fv as attrsEqual,U_ as canonicalPmToMdxOptions,xn as createSchema,dv as deepEqual,ay as diffDocs,Am as extractDiffMarkers,Un as extractFrontmatter,bv as extractText,wh as filterFrontmatterRecord,Vn as findRedundantStaticHtmlSources,Ih as formatFrontmatterValue,Mm as formatLineRanges,Nm as getDiffMarkerComment,mp as getImageAlignFromClassName,hp as getImageWidthFromStyle,wn as isDatabaseId,Tn as isDatabaseView,Lh as isJSXContent,Ch as isNonEmptyFrontmatterValue,Sh as mdToPm,iy as mdastToMdx,Gm as mdastToPm,$f as mdxToMdast,$m as mdxToPm,ky as mergeRemoteIntoLiveDoc,bn as mintlifySchema,yv as nodeSize,Sv as nodesMatch,Ln as parseCommentThreadIds,sp as parseExpressionAttribute,Hn as parseFrontmatterYaml,jm as parseLineRanges,$ as parseMdxAttributes,km as parseMetaString,ry as pmJsonToMdast,Y_ as pmToMdx,Pv as pmToMdxPreservingSource,Fn as readDatabaseSql,En as resolveDatabaseView,Ah as safeJsonParse,lp as sanitizeDomAttrs,Rn as serializeCommentThreadIds,Mn as serializeDatabaseSql,Bh as serializePropValue,av as startsWithPlaceholderParagraph,Mh as storedValueToTyped,xv as textSimilarity};
package/dist/start.js CHANGED
@@ -5,4 +5,4 @@ import { dirname as __mintDirname } from 'node:path';
5
5
  const require = __mintCreateRequire(import.meta.url);
6
6
  const __filename = __mintFileURLToPath(import.meta.url);
7
7
  const __dirname = __mintDirname(__filename);
8
- import{r as e}from"./client-DXQ6Tgw0.js";var t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function n(e,n=e=>process.exit(e)){let r;return i=>(r??=t(this,void 0,void 0,function*(){try{yield e()}catch(e){return console.error(`Preview cleanup failed:`,e),n(1)}return n(i)}),r)}var r=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const i=process.env.MINTLIFY_PACKAGE_NAME??`mint`;let a;function o(){return r(this,void 0,void 0,function*(){let e=a;a=void 0,yield e?.()})}function s(){return r(this,void 0,void 0,function*(){let e=process.argv.slice(2);if(e.some(e=>[`--multi-repo`,`--workspace`,`--setup`,`--non-interactive`].includes(e.split(`=`)[0]??``))){let{isMultiRepoDev:t,runMultiRepoDev:n}=yield import(`./multi-repo-command-CgNdlCrf.js`);if(t(e)){yield n(e,i,e=>{a=e},()=>c(0));return}}let{cli:t}=yield import(`./cli-EPMpvBYK.js`);yield t({packageName:i})})}s().catch(e=>r(void 0,void 0,void 0,function*(){console.error(e instanceof Error?e.message:e),yield c(1)}));const c=n(()=>r(void 0,void 0,void 0,function*(){try{yield o()}finally{yield e()}}));process.once(`beforeExit`,()=>r(void 0,void 0,void 0,function*(){try{yield o(),yield e()}catch{}})),process.on(`SIGINT`,()=>{c(130)}),process.on(`SIGTERM`,()=>{c(143)});export{};
8
+ import{r as e}from"./client-DXQ6Tgw0.js";var t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function n(e,n=e=>process.exit(e)){let r;return i=>(r??=t(this,void 0,void 0,function*(){try{yield e()}catch(e){return console.error(`Preview cleanup failed:`,e),n(1)}return n(i)}),r)}var r=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const i=process.env.MINTLIFY_PACKAGE_NAME??`mint`;let a;function o(){return r(this,void 0,void 0,function*(){let e=a;a=void 0,yield e?.()})}function s(){return r(this,void 0,void 0,function*(){let e=process.argv.slice(2);if(e.some(e=>[`--multi-repo`,`--workspace`,`--setup`,`--non-interactive`].includes(e.split(`=`)[0]??``))){let{isMultiRepoDev:t,runMultiRepoDev:n}=yield import(`./multi-repo-command-CgNdlCrf.js`);if(t(e)){yield n(e,i,e=>{a=e},()=>c(0));return}}let{cli:t}=yield import(`./cli-kKP-fSwl.js`);yield t({packageName:i})})}s().catch(e=>r(void 0,void 0,void 0,function*(){console.error(e instanceof Error?e.message:e),yield c(1)}));const c=n(()=>r(void 0,void 0,void 0,function*(){try{yield o()}finally{yield e()}}));process.once(`beforeExit`,()=>r(void 0,void 0,void 0,function*(){try{yield o(),yield e()}catch{}})),process.on(`SIGINT`,()=>{c(130)}),process.on(`SIGTERM`,()=>{c(143)});export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.1.96",
3
+ "version": "4.1.98",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -47,7 +47,7 @@
47
47
  "sharp": "0.33.5"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@mintlify/package-builder": "0.0.203",
50
+ "@mintlify/package-builder": "0.0.204",
51
51
  "@parcel/watcher": "2.5.1",
52
52
  "fsevents": "2.3.3",
53
53
  "keytar": "7.9.0"
@@ -55,15 +55,15 @@
55
55
  "devDependencies": {
56
56
  "@babel/parser": "7.21.2",
57
57
  "@inquirer/prompts": "7.9.0",
58
- "@mintlify/common": "1.0.1414",
59
- "@mintlify/editor": "0.0.694",
60
- "@mintlify/link-rot": "3.0.1673",
58
+ "@mintlify/common": "1.0.1415",
59
+ "@mintlify/editor": "0.0.696",
60
+ "@mintlify/link-rot": "3.0.1674",
61
61
  "@mintlify/models": "0.0.407",
62
- "@mintlify/og": "0.0.213",
63
- "@mintlify/prebuild": "1.0.1594",
64
- "@mintlify/previewing": "4.0.1687",
62
+ "@mintlify/og": "0.0.214",
63
+ "@mintlify/prebuild": "1.0.1595",
64
+ "@mintlify/previewing": "4.0.1688",
65
65
  "@mintlify/ts-config": "2.0.2",
66
- "@mintlify/validation": "0.1.994",
66
+ "@mintlify/validation": "0.1.995",
67
67
  "@tsconfig/recommended": "1.0.2",
68
68
  "@types/detect-port": "1.3.2",
69
69
  "@types/keytar": "4.4.2",
@@ -110,5 +110,5 @@
110
110
  "yargs": "17.7.1",
111
111
  "zod": "4.3.6"
112
112
  },
113
- "gitHead": "a087d2d59974eceb9c5ac323ee8488efb7d0f79f"
113
+ "gitHead": "8bf904b8b1a6d68fa977f0c8ea834f7532fffe73"
114
114
  }